Hello. I used this ( http://www.cplusplus.com/forum/general/97555/#msg523529 ) example to sort an array of classes. But what if I want to modify "Option 1" (made by Stewbond) so that if lhs.num1==rhs.num1 the program would remain sorting by another member (num2 in this example)?
std::tie returns a tuple of references. And tuples already have well-defined comparison behavior: it compares first elements, if they equal, it compares seconds and so on.