forked from p12tic/cppreference-doc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutility
More file actions
253 lines (202 loc) · 6.73 KB
/
utility
File metadata and controls
253 lines (202 loc) · 6.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
/* Copyright (C) 2015 Povilas Kanapickas <povilas@radix.lt>
This file is part of cppreference-doc
This work is licensed under the Creative Commons Attribution-ShareAlike 3.0
Unported License. To view a copy of this license, visit
http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative
Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
*/
#ifndef CPPREFERENCE_UTILITY_H
#define CPPREFERENCE_UTILITY_H
#if CPPREFERENCE_STDVER>= 2011
#include <initializer_list>
#endif
#include <cstddef> // for size_t
#include <type_traits> // for remove_reference
namespace std {
#if CPPREFERENCE_STDVER>= 2011
// defined in <algorithm> pre C++11
template<class T>
void swap(T& a, T& b);
template<class T2, size_t N>
void swap(T2(&a)[N], T2(&b)[N]);
#endif
namespace rel_ops {
template<class T>
bool operator!=(const T& lhs, const T& rhs);
template<class T>
bool operator>(const T& lhs, const T& rhs);
template<class T>
bool operator<=(const T& lhs, const T& rhs);
template<class T>
bool operator>=(const T& lhs, const T& rhs);
} // namespace rel_ops
#if CPPREFERENCE_STDVER >= 2020
template<class T, class U = T>
constexpr T exchange(T& obj, U && new_value);
#elif CPPREFERENCE_STDVER >= 2014
template<class T, class U = T>
T exchange(T& obj, U && new_value);
#endif
#if CPPREFERENCE_STDVER >= 2014
template<class T>
constexpr T&& forward(typename std::remove_reference<T>::type& t);
template<class T>
constexpr T&& forward(typename std::remove_reference<T>::type&& t);
#elif CPPREFERENCE_STDVER >= 2011
template<class T>
T&& forward(typename std::remove_reference<T>::type& t);
template<class T>
T&& forward(typename std::remove_reference<T>::type&& t);
#endif
#if CPPREFERENCE_STDVER >= 2014
template<class T>
constexpr T&& move(T&& t); // SIMPLIFIED: return type
#elif CPPREFERENCE_STDVER >= 2011
template<class T>
T&& move(T&& t); // SIMPLIFIED: return type
#endif
#if CPPREFERENCE_STDVER >= 2014
template<class T>
constexpr T&& move_if_noexcept(T&& t); // SIMPLIFIED: return type
#elif CPPREFERENCE_STDVER >= 2011
template<class T>
T&& move_if_noexcept(T&& t); // SIMPLIFIED: return type
#endif
#if CPPREFERENCE_STDVER >= 2011
template<class T>
T declval(); // SIMPLIFIED: return type
#endif
#if CPPREFERENCE_STDVER >= 2011
struct piecewise_construct_t { };
constexpr piecewise_construct_t piecewise_construct;
#endif
#if CPPREFERENCE_STDVER >= 2017
struct in_place_t {};
inline constexpr in_place_t in_place;
template<class T>
struct in_place_type_t{};
template<class T>
inline constexpr in_place_type_t<T> in_place_type;
template<size_t I>
struct in_place_index_t;
template<size_t I>
inline constexpr in_place_index_t<I> in_place_index;
#endif
template<class ... Args> class tuple;
template <
class T1,
class T2
> struct pair {
typedef T1 first_type;
typedef T2 second_type;
T1 first;
T2 second;
#if CPPREFERENCE_STDVER >= 2011
constexpr pair();
#else
pair();
#endif
#if CPPREFERENCE_STDVER >= 2014
constexpr pair(const T1& x, const T2& y);
template<class U1, class U2>
constexpr pair(const pair<U1, U2>& p);
constexpr pair(const pair& p);
#else
pair(const T1& x, const T2& y);
template<class U1, class U2>
pair(const pair<U1, U2>& p);
pair(const pair& p);
#endif
#if CPPREFERENCE_STDVER >= 2014
template<class U1, class U2>
constexpr pair(U1&& x, U2&& y);
template<class U1, class U2>
constexpr pair(pair<U1, U2>&& p);
constexpr pair(pair&& p);
#elif CPPREFERENCE_STDVER >= 2011
template<class U1, class U2>
pair(U1&& x, U2&& y);
template<class U1, class U2>
pair(pair<U1, U2>&& p);
pair(pair&& p);
#endif
#if CPPREFERENCE_STDVER >= 2020
template<class... Args1, class... Args2>
constexpr pair(std::piecewise_construct_t,
std::tuple<Args1...> first_args,
std::tuple<Args2...> second_args);
#elif CPPREFERENCE_STDVER >= 2011
template<class... Args1, class... Args2>
pair(std::piecewise_construct_t,
std::tuple<Args1...> first_args,
std::tuple<Args2...> second_args);
#endif
pair& operator=(const pair& other);
template<class U1, class U2>
pair& operator=(const pair<U1, U2>& other);
#if CPPREFERENCE_STDVER>= 2011
pair& operator=(pair&& other);
template<class U1, class U2>
pair& operator=(pair<U1, U2>&& other);
#endif
void swap(pair& other);
};
#if CPPREFERENCE_STDVER >= 2014
template<class T1, class T2>
constexpr bool operator==(const pair<T1, T2>& lhs, const pair<T1, T2>& rhs);
template<class T1, class T2>
constexpr bool operator!=(const pair<T1, T2>& lhs, const pair<T1, T2>& rhs);
template<class T1, class T2>
constexpr bool operator<(const pair<T1, T2>& lhs, const pair<T1, T2>& rhs);
template<class T1, class T2>
constexpr bool operator<=(const pair<T1, T2>& lhs, const pair<T1, T2>& rhs);
template<class T1, class T2>
constexpr bool operator>(const pair<T1, T2>& lhs, const pair<T1, T2>& rhs);
template<class T1, class T2>
constexpr bool operator>=(const pair<T1, T2>& lhs, const pair<T1, T2>& rhs);
#else
template<class T1, class T2>
bool operator==(const pair<T1, T2>& lhs, const pair<T1, T2>& rhs);
template<class T1, class T2>
bool operator!=(const pair<T1, T2>& lhs, const pair<T1, T2>& rhs);
template<class T1, class T2>
bool operator<(const pair<T1, T2>& lhs, const pair<T1, T2>& rhs);
template<class T1, class T2>
bool operator<=(const pair<T1, T2>& lhs, const pair<T1, T2>& rhs);
template<class T1, class T2>
bool operator>(const pair<T1, T2>& lhs, const pair<T1, T2>& rhs);
template<class T1, class T2>
bool operator>=(const pair<T1, T2>& lhs, const pair<T1, T2>& rhs);
#endif
#if CPPREFERENCE_STDVER >= 2014
template<class T1, class T2>
constexpr std::pair<T1, T2> make_pair(T1&& t, T2&& u);
#elif CPPREFERENCE_STDVER >= 2011
template<class T1, class T2>
std::pair<T1, T2> make_pair(T1&& t, T2&& u);
#else
template<class T1, class T2>
std::pair<T1, T2> make_pair(T1 t, T2 u);
#endif
template<class T1, class T2>
void swap(pair<T1, T2>& lhs, pair<T1, T2>& rhs);
#if CPPREFERENCE_STDVER>= 2011
template<size_t N, class T>
class tuple_element;
template<size_t N, class T1, class T2>
typename tuple_element<N, std::pair<T1, T2>>::type&
get(pair<T1, T2>& p);
// SIMPLIFIED: additional overloads omitted
#endif
#if CPPREFERENCE_STDVER >= 2014
template<class T>
class tuple_size;
template<class T1, class T2>
class tuple_size<std::pair<T1, T2> > : public std::integral_constant<std::size_t, 2> { };
#endif
} // namespace std
#endif // CPPREFERENCE_UTILITY_H