struct SimGenRequest {
int wakeup_mfm_;
double value_;
bool operator < ( const SimGenRequest & r2 ) const
{ return ( wakeup_mfm_ < r2.wakeup_mfm_ ) ; }
};
Use :
std::stable_sort ( all_requests_.begin ( ), all_requests_.end ( ) );
Works ( compiles ). But
struct SimGenRequest {
int wakeup_mfm_;
double value_;
};
bool CompareByWakeTime ( const SimGenRequest & r1, const SimGenRequest & r2 ) {
return ( r1.wakeup_mfm_ < r2.wakeup_mfm_ ) ;
}
Use :
std::stable_sort ( all_requests_.begin ( ), all_requests_.end ( ),
CompareByWakeTime );
does not work. Any pointers ?