I would like to create a class, call it MyClass
which has three data members- a, b and c. I then wish to put many MyClass
objects in to a std::Vector<MyClass>
and then sort the Vector according to the a data members.
Is there an elegant way of doing this using the STL? I didn't want to re-invent the wheel and I am sure this can't be a first. In Java I guess I would use a Comparator
.