
Greetings, I have no idea why the following code does not work. Seems to work fine when I try sorting a vector of ints instead. I have even overloaded the < operator. If I understand correctly, this is the only requirement to sort a userdefined class. The compiler gets mad and spits out a a whole bunch of errors. thanx #include "boost/tuple/tuple_io.hpp" #include <vector> #include <algorithm> typedef boost::tuple<unsigned long int, unsigned long int, double, unsigned long int> Task; typedef std::vector<Task> TaskSet; bool operator<(const Task& a, const Task& b) { return boost::get<1>(a) < boost::get<1>(b); } int main(int argc, char** argv) { TaskSet ts; ts.push_back( boost::make_tuple(0, 0, 0, 0) ); ts.push_back( boost::make_tuple(3, 3, 3, 3) ); ts.push_back( boost::make_tuple(2, 2, 2, 2) ); std::sort(ts.begin(), ts.end()); return 0; }