N
Nenad Jalsovec
using std::list;
struct Something{
Something( val ): value( val ){}
bool operator<( Something & s ){ return value < s.value; }
int value;
};
main(){
list< Something * > things;
things.pushBack( new Something( 10 ) );
things.pushBack( new Something( 20 ) );
things.sort();
}
How to force things.sort() to use Something:perator<( Something & )
instead of default operator< for pointers ?
struct Something{
Something( val ): value( val ){}
bool operator<( Something & s ){ return value < s.value; }
int value;
};
main(){
list< Something * > things;
things.pushBack( new Something( 10 ) );
things.pushBack( new Something( 20 ) );
things.sort();
}
How to force things.sort() to use Something:perator<( Something & )
instead of default operator< for pointers ?