From Jason Turner

[expos.only.entity]

Diff to HTML by rtfpessoa

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