16 Library introduction [library]

16.3 Definitions [definitions]

16.3.22[defns.projection]projection

⟨function object argument⟩ transformation that an algorithm applies before inspecting the values of elements
Example
:
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"}}
— end example
 ]