From Jason Turner

[utility.syn]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp0scqnj98/{from.md → to.md} +47 -92
tmp/tmp0scqnj98/{from.md → to.md} RENAMED
@@ -1,28 +1,24 @@
1
  ### Header `<utility>` synopsis <a id="utility.syn">[[utility.syn]]</a>
2
 
 
 
 
3
  ``` cpp
4
- #include <initializer_list> // see [initializer_list.syn]
 
5
 
6
  namespace std {
7
- // [operators], operators
8
- namespace rel_ops {
9
- template<class T> bool operator!=(const T&, const T&);
10
- template<class T> bool operator> (const T&, const T&);
11
- template<class T> bool operator<=(const T&, const T&);
12
- template<class T> bool operator>=(const T&, const T&);
13
- }
14
-
15
  // [utility.swap], swap
16
  template<class T>
17
- void swap(T& a, T& b) noexcept(see below);
18
  template<class T, size_t N>
19
- void swap(T (&a)[N], T (&b)[N]) noexcept(is_nothrow_swappable_v<T>);
20
 
21
  // [utility.exchange], exchange
22
  template<class T, class U = T>
23
- T exchange(T& obj, U&& new_val);
24
 
25
  // [forward], forward/move
26
  template<class T>
27
  constexpr T&& forward(remove_reference_t<T>& t) noexcept;
28
  template<class T>
@@ -32,22 +28,42 @@ namespace std {
32
  template<class T>
33
  constexpr conditional_t<
34
  !is_nothrow_move_constructible_v<T> && is_copy_constructible_v<T>, const T&, T&&>
35
  move_if_noexcept(T& x) noexcept;
36
 
37
- // [utility.as_const], as_const
38
  template<class T>
39
  constexpr add_const_t<T>& as_const(T& t) noexcept;
40
  template<class T>
41
  void as_const(const T&&) = delete;
42
 
43
  // [declval], declval
44
  template<class T>
45
  add_rvalue_reference_t<T> declval() noexcept; // as unevaluated operand
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  %
47
 
48
- // [intseq], Compile-time integer sequences
49
  template<class T, T...>
50
  struct integer_sequence;
51
  template<size_t... I>
52
  using index_sequence = integer_sequence<size_t, I...>;
53
 
@@ -65,33 +81,26 @@ namespace std {
65
 
66
  // [pairs.spec], pair specialized algorithms
67
  template<class T1, class T2>
68
  constexpr bool operator==(const pair<T1, T2>&, const pair<T1, T2>&);
69
  template<class T1, class T2>
70
- constexpr bool operator< (const pair<T1, T2>&, const pair<T1, T2>&);
71
- template <class T1, class T2>
72
- constexpr bool operator!=(const pair<T1, T2>&, const pair<T1, T2>&);
73
- template <class T1, class T2>
74
- constexpr bool operator> (const pair<T1, T2>&, const pair<T1, T2>&);
75
- template <class T1, class T2>
76
- constexpr bool operator>=(const pair<T1, T2>&, const pair<T1, T2>&);
77
- template <class T1, class T2>
78
- constexpr bool operator<=(const pair<T1, T2>&, const pair<T1, T2>&);
79
 
80
  template<class T1, class T2>
81
- void swap(pair<T1, T2>& x, pair<T1, T2>& y) noexcept(noexcept(x.swap(y)));
82
 
83
  template<class T1, class T2>
84
  constexpr see below make_pair(T1&&, T2&&);
85
 
86
  // [pair.astuple], tuple-like access to pair
87
- template <class T> class tuple_size;
88
- template <size_t I, class T> class tuple_element;
89
 
90
  template<class T1, class T2> struct tuple_size<pair<T1, T2>>;
91
- template <class T1, class T2> struct tuple_element<0, pair<T1, T2>>;
92
- template <class T1, class T2> struct tuple_element<1, pair<T1, T2>>;
93
 
94
  template<size_t I, class T1, class T2>
95
  constexpr tuple_element_t<I, pair<T1, T2>>& get(pair<T1, T2>&) noexcept;
96
  template<size_t I, class T1, class T2>
97
  constexpr tuple_element_t<I, pair<T1, T2>>&& get(pair<T1, T2>&&) noexcept;
@@ -119,87 +128,33 @@ namespace std {
119
  // [pair.piecewise], pair piecewise construction
120
  struct piecewise_construct_t {
121
  explicit piecewise_construct_t() = default;
122
  };
123
  inline constexpr piecewise_construct_t piecewise_construct{};
124
- template <class... Types> class tuple; // defined in <tuple> ([tuple.syn])
 
 
 
 
 
 
 
125
 
126
- // in-place construction
127
  struct in_place_t {
128
  explicit in_place_t() = default;
129
  };
130
  inline constexpr in_place_t in_place{};
 
131
  template<class T>
132
  struct in_place_type_t {
133
  explicit in_place_type_t() = default;
134
  };
135
  template<class T> inline constexpr in_place_type_t<T> in_place_type{};
 
136
  template<size_t I>
137
  struct in_place_index_t {
138
  explicit in_place_index_t() = default;
139
  };
140
  template<size_t I> inline constexpr in_place_index_t<I> in_place_index{};
141
-
142
- {chars_format{chars_format{chars_format{chars_format
143
- // floating-point format for primitive numerical conversion
144
- enum class chars_format {
145
- scientific = unspecified,
146
- fixed = unspecified,
147
- hex = unspecified,
148
- general = fixed | scientific
149
- };
150
-
151
- {to_chars_result{to_chars_result}
152
-
153
- // [utility.to.chars], primitive numerical output conversion
154
- struct to_chars_result {
155
- char* ptr;
156
- error_code ec;
157
- };
158
-
159
- to_chars_result to_chars(char* first, char* last, see below value, int base = 10);
160
-
161
- to_chars_result to_chars(char* first, char* last, float value);
162
- to_chars_result to_chars(char* first, char* last, double value);
163
- to_chars_result to_chars(char* first, char* last, long double value);
164
-
165
- to_chars_result to_chars(char* first, char* last, float value,
166
- chars_format fmt);
167
- to_chars_result to_chars(char* first, char* last, double value,
168
- chars_format fmt);
169
- to_chars_result to_chars(char* first, char* last, long double value,
170
- chars_format fmt);
171
-
172
- to_chars_result to_chars(char* first, char* last, float value,
173
- chars_format fmt, int precision);
174
- to_chars_result to_chars(char* first, char* last, double value,
175
- chars_format fmt, int precision);
176
- to_chars_result to_chars(char* first, char* last, long double value,
177
- chars_format fmt, int precision);
178
-
179
- {from_chars_result{from_chars_result}
180
-
181
- // [utility.from.chars], primitive numerical input conversion
182
- struct from_chars_result {
183
- const char* ptr;
184
- error_code ec;
185
- };
186
-
187
- from_chars_result from_chars(const char* first, const char* last,
188
- see below& value, int base = 10);
189
-
190
- from_chars_result from_chars(const char* first, const char* last, float& value,
191
- chars_format fmt = chars_format::general);
192
- from_chars_result from_chars(const char* first, const char* last, double& value,
193
- chars_format fmt = chars_format::general);
194
- from_chars_result from_chars(const char* first, const char* last, long double& value,
195
- chars_format fmt = chars_format::general);
196
  }
197
  ```
198
 
199
- The header `<utility>` defines several types and function templates that
200
- are described in this Clause. It also defines the template `pair` and
201
- various function templates that operate on `pair` objects.
202
-
203
- The type `chars_format` is a bitmask type ([[bitmask.types]]) with
204
- elements `scientific`, `fixed`, and `hex`.
205
-
 
1
  ### Header `<utility>` synopsis <a id="utility.syn">[[utility.syn]]</a>
2
 
3
+ The header `<utility>` contains some basic function and class templates
4
+ that are used throughout the rest of the library.
5
+
6
  ``` cpp
7
+ #include <compare> // see [compare.syn]
8
+ #include <initializer_list> // see [initializer.list.syn]
9
 
10
  namespace std {
 
 
 
 
 
 
 
 
11
  // [utility.swap], swap
12
  template<class T>
13
+ constexpr void swap(T& a, T& b) noexcept(see below);
14
  template<class T, size_t N>
15
+ constexpr void swap(T (&a)[N], T (&b)[N]) noexcept(is_nothrow_swappable_v<T>);
16
 
17
  // [utility.exchange], exchange
18
  template<class T, class U = T>
19
+ constexpr T exchange(T& obj, U&& new_val);
20
 
21
  // [forward], forward/move
22
  template<class T>
23
  constexpr T&& forward(remove_reference_t<T>& t) noexcept;
24
  template<class T>
 
28
  template<class T>
29
  constexpr conditional_t<
30
  !is_nothrow_move_constructible_v<T> && is_copy_constructible_v<T>, const T&, T&&>
31
  move_if_noexcept(T& x) noexcept;
32
 
33
+ // [utility.as.const], as_const
34
  template<class T>
35
  constexpr add_const_t<T>& as_const(T& t) noexcept;
36
  template<class T>
37
  void as_const(const T&&) = delete;
38
 
39
  // [declval], declval
40
  template<class T>
41
  add_rvalue_reference_t<T> declval() noexcept; // as unevaluated operand
42
+
43
+ // [utility.intcmp], integer comparison functions
44
+ template<class T, class U>
45
+ constexpr bool cmp_equal(T t, U u) noexcept;
46
+ template<class T, class U>
47
+ constexpr bool cmp_not_equal(T t, U u) noexcept;
48
+
49
+ template<class T, class U>
50
+ constexpr bool cmp_less(T t, U u) noexcept;
51
+ template<class T, class U>
52
+ constexpr bool cmp_greater(T t, U u) noexcept;
53
+ template<class T, class U>
54
+ constexpr bool cmp_less_equal(T t, U u) noexcept;
55
+ template<class T, class U>
56
+ constexpr bool cmp_greater_equal(T t, U u) noexcept;
57
+
58
+ template<class R, class T>
59
+ constexpr bool in_range(T t) noexcept;
60
+
61
+ // [intseq], compile-time integer sequences%
62
+ %
63
  %
64
 
 
65
  template<class T, T...>
66
  struct integer_sequence;
67
  template<size_t... I>
68
  using index_sequence = integer_sequence<size_t, I...>;
69
 
 
81
 
82
  // [pairs.spec], pair specialized algorithms
83
  template<class T1, class T2>
84
  constexpr bool operator==(const pair<T1, T2>&, const pair<T1, T2>&);
85
  template<class T1, class T2>
86
+ constexpr common_comparison_category_t<synth-three-way-result<T1>,
87
+ synth-three-way-result<T2>>
88
+ operator<=>(const pair<T1, T2>&, const pair<T1, T2>&);
 
 
 
 
 
 
89
 
90
  template<class T1, class T2>
91
+ constexpr void swap(pair<T1, T2>& x, pair<T1, T2>& y) noexcept(noexcept(x.swap(y)));
92
 
93
  template<class T1, class T2>
94
  constexpr see below make_pair(T1&&, T2&&);
95
 
96
  // [pair.astuple], tuple-like access to pair
97
+ template<class T> struct tuple_size;
98
+ template<size_t I, class T> struct tuple_element;
99
 
100
  template<class T1, class T2> struct tuple_size<pair<T1, T2>>;
101
+ template<size_t I, class T1, class T2> struct tuple_element<I, pair<T1, T2>>;
 
102
 
103
  template<size_t I, class T1, class T2>
104
  constexpr tuple_element_t<I, pair<T1, T2>>& get(pair<T1, T2>&) noexcept;
105
  template<size_t I, class T1, class T2>
106
  constexpr tuple_element_t<I, pair<T1, T2>>&& get(pair<T1, T2>&&) noexcept;
 
128
  // [pair.piecewise], pair piecewise construction
129
  struct piecewise_construct_t {
130
  explicit piecewise_construct_t() = default;
131
  };
132
  inline constexpr piecewise_construct_t piecewise_construct{};
133
+ template<class... Types> class tuple; // defined in <tuple>
134
+
135
+ // in-place construction%
136
+ %
137
+ %
138
+ %
139
+ %
140
+ %
141
 
 
142
  struct in_place_t {
143
  explicit in_place_t() = default;
144
  };
145
  inline constexpr in_place_t in_place{};
146
+
147
  template<class T>
148
  struct in_place_type_t {
149
  explicit in_place_type_t() = default;
150
  };
151
  template<class T> inline constexpr in_place_type_t<T> in_place_type{};
152
+
153
  template<size_t I>
154
  struct in_place_index_t {
155
  explicit in_place_index_t() = default;
156
  };
157
  template<size_t I> inline constexpr in_place_index_t<I> in_place_index{};
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
158
  }
159
  ```
160