std::pair<int, std::string_view> pairs[] = {{2, "foo"}, {1, "bar"}, {0, "baz"}}; std::ranges::sort(pairs, std::ranges::less{}, [](auto const& p) { return p.first; });sorts the pairs in increasing order of their first members:
{{0, "baz"}, {1, "bar"}, {2, "foo"}}