I understand you can insert a user-defined class in to a std::vector and then overload the sorting mechanism so that it compares on a particular data member. Ho
std::vector
Create a custom comparator using std::tuple
#include <tuple> //.. struct comp { bool operator()(const MyClass& lhs, const MyClass& rhs) const { return std::tie(lhs.a, lhs.b) < std::tie(rhs.a, rhs.b); } };
It will use a first and then b second
a
b