From Jason Turner

[expos.only.func]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpk2n3eyxc/{from.md → to.md} +34 -0
tmp/tmpk2n3eyxc/{from.md → to.md} RENAMED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Exposition-only functions <a id="expos.only.func">[[expos.only.func]]</a>
2
+
3
+ Several function templates defined in [[support]] through [[thread]] and
4
+ [[depr]] are only defined for the purpose of exposition. The declaration
5
+ of such a function is followed by a comment ending in *exposition only*.
6
+
7
+ The following are defined for exposition only to aid in the
8
+ specification of the library:
9
+
10
+ ``` cpp
11
+ template<class T> constexpr decay_t<T> decay-copy(T&& v)
12
+ noexcept(is_nothrow_convertible_v<T, decay_t<T>>) // exposition only
13
+ { return std::forward<T>(v); }
14
+
15
+ constexpr auto synth-three-way =
16
+ []<class T, class U>(const T& t, const U& u)
17
+ requires requires {
18
+ { t < u } -> boolean-testable;
19
+ { u < t } -> boolean-testable;
20
+ }
21
+ {
22
+ if constexpr (three_way_comparable_with<T, U>) {
23
+ return t <=> u;
24
+ } else {
25
+ if (t < u) return weak_ordering::less;
26
+ if (u < t) return weak_ordering::greater;
27
+ return weak_ordering::equivalent;
28
+ }
29
+ };
30
+
31
+ template<class T, class U=T>
32
+ using synth-three-way-result = decltype(synth-three-way(declval<T&>(), declval<U&>()));
33
+ ```
34
+