Legfrissebb anyagok
IT café témák
PROHARDVER! témák
Mobilarena témák
GAMEPOD.hu témák
Új hozzászólás Aktív témák
-
sghc_toma
senior tag
ha irtal kisebb operatort, akkor nem kell harmadik parameter, mivel a sort alapbol azt hasznalja.. tehat pl. ennek igy mukodnie kell:
#include <vector>
#include <algorithm>
class Product
{
//...
int value;
public:
friend bool operator<(const Product & p1, const Product & p2);
}
bool operator<(const Product & p1, const Product & p2)
{
return p1.value < p2.value;
}
int main()
{
std::vector<Product> products;
//...
std::sort(products.begin(), products.end());
return 0;
}[ Szerkesztve ]
in asm we trust
Új hozzászólás Aktív témák
Téma tudnivalók
● ha kódot szúrsz be, használd a PROGRAMKÓD formázási funkciót!
Aktív témák
Új prémium hirdetések