Sort a std::vector<std::pair<...>>
in-place by the first
element of the pair:
std::sort(ret.begin(), ret.end(), [](const auto& a, const auto& b) { return a.first < b.first; });
Sort a std::vector<std::pair<...>>
in-place by the second
element of the pair:
std::sort(ret.begin(), ret.end(), [](const auto& a, const auto& b) { return a.second < b.second; });