From Jason Turner

[utility.syn]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpzb1hr0tr/{from.md → to.md} +205 -0
tmp/tmpzb1hr0tr/{from.md → to.md} RENAMED
@@ -0,0 +1,205 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>
29
+ constexpr T&& forward(remove_reference_t<T>&& t) noexcept;
30
+ template <class T>
31
+ constexpr remove_reference_t<T>&& move(T&&) noexcept;
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
+
54
+ template<class T, T N>
55
+ using make_integer_sequence = integer_sequence<T, see below>;
56
+ template<size_t N>
57
+ using make_index_sequence = make_integer_sequence<size_t, N>;
58
+
59
+ template<class... T>
60
+ using index_sequence_for = make_index_sequence<sizeof...(T)>;
61
+
62
+ // [pairs], class template pair
63
+ template <class T1, class T2>
64
+ struct pair;
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;
98
+ template<size_t I, class T1, class T2>
99
+ constexpr const tuple_element_t<I, pair<T1, T2>>& get(const pair<T1, T2>&) noexcept;
100
+ template<size_t I, class T1, class T2>
101
+ constexpr const tuple_element_t<I, pair<T1, T2>>&& get(const pair<T1, T2>&&) noexcept;
102
+ template <class T1, class T2>
103
+ constexpr T1& get(pair<T1, T2>& p) noexcept;
104
+ template <class T1, class T2>
105
+ constexpr const T1& get(const pair<T1, T2>& p) noexcept;
106
+ template <class T1, class T2>
107
+ constexpr T1&& get(pair<T1, T2>&& p) noexcept;
108
+ template <class T1, class T2>
109
+ constexpr const T1&& get(const pair<T1, T2>&& p) noexcept;
110
+ template <class T2, class T1>
111
+ constexpr T2& get(pair<T1, T2>& p) noexcept;
112
+ template <class T2, class T1>
113
+ constexpr const T2& get(const pair<T1, T2>& p) noexcept;
114
+ template <class T2, class T1>
115
+ constexpr T2&& get(pair<T1, T2>&& p) noexcept;
116
+ template <class T2, class T1>
117
+ constexpr const T2&& get(const pair<T1, T2>&& p) noexcept;
118
+
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
+