std::vector<std::pair<std::string, bool> > v;
std::sort(v.begin(), v.end());
std::pair
overloads operator<
to sort first by the first
element then by the second
element. Thus, if you just sort the vector
using the default sort ordering (operator<
), you'll get your desired ordering.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…