Well, at the very least you could store the values in a POD struct, e.g.,
Code:
struct ValueList
{
int values[3];
};
Then you define a predicate to make the comparison by the first value and then by the second value:
Code:
class ValueListComparator
{
public:
bool operator()(const ValueList& x, ValueList& y) const
{
return x.values[0] < y.values[0]
|| (x.values[0] == y.values[0] && x.values[1] < y.values[1]);
}
};
With these in place, you can just use the sort generic algorithm from <algorithm> with say, a std::vector<ValueList> named values:
Code:
std::sort(values.begin(), values.end(), ValueListComparator());