From Jason Turner

[defns.projection]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp0eurbm_i/{from.md → to.md} +20 -0
tmp/tmp0eurbm_i/{from.md → to.md} RENAMED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### 22 projection <a id="defns.projection">[[defns.projection]]</a>
2
+
3
+ ⟨function object argument⟩ transformation that an algorithm applies
4
+ before inspecting the values of elements
5
+
6
+ [*Example 1*:
7
+
8
+ ``` cpp
9
+ std::pair<int, std::string_view> pairs[] = {{2, "foo"}, {1, "bar"}, {0, "baz"}};
10
+ std::ranges::sort(pairs, std::ranges::less{}, [](auto const& p) { return p.first; });
11
+ ```
12
+
13
+ sorts the pairs in increasing order of their `first` members:
14
+
15
+ ``` cpp
16
+ {{0, "baz"}, {1, "bar"}, {2, "foo"}}
17
+ ```
18
+
19
+ — *end example*]
20
+