33#ifndef _GLIBCXX_UTILITY_H
34#define _GLIBCXX_UTILITY_H 1
36#pragma GCC system_header
38#if __cplusplus >= 201103L
43namespace std _GLIBCXX_VISIBILITY(default)
45_GLIBCXX_BEGIN_NAMESPACE_VERSION
48 template<
typename _Tp>
55 template<
typename _Tp,
56 typename _Up =
typename remove_cv<_Tp>::type,
59 using __enable_if_has_tuple_size = _Tp;
61 template<
typename _Tp>
62 struct tuple_size<const __enable_if_has_tuple_size<_Tp>>
65 template<
typename _Tp>
66 struct tuple_size<volatile __enable_if_has_tuple_size<_Tp>>
69 template<
typename _Tp>
70 struct tuple_size<const volatile __enable_if_has_tuple_size<_Tp>>
71 :
public tuple_size<_Tp> { };
73#if __cplusplus >= 201703L
74 template<
typename _Tp>
75 inline constexpr size_t tuple_size_v = tuple_size<_Tp>::value;
79 template<
size_t __i,
typename _Tp>
83 template<
size_t __i,
typename _Tp>
86 template<
size_t __i,
typename _Tp>
92 template<
size_t __i,
typename _Tp>
98 template<
size_t __i,
typename _Tp>
99 struct tuple_element<__i, const volatile _Tp>
101 typedef typename add_cv<__tuple_element_t<__i, _Tp>>::type type;
104#if __cplusplus >= 201402L
108 template<
typename _Tp,
typename... _Types>
110 __find_uniq_type_in_pack()
112 constexpr size_t __sz =
sizeof...(_Types);
113 constexpr bool __found[__sz] = { __is_same(_Tp, _Types) ... };
115 for (
size_t __i = 0; __i < __sz; ++__i)
132#define __cpp_lib_tuple_element_t 201402L
134 template<
size_t __i,
typename _Tp>
135 using tuple_element_t =
typename tuple_element<__i, _Tp>::type;
140 template<
size_t... _Indexes>
struct _Index_tuple { };
143 template<
size_t _Num>
144 struct _Build_index_tuple
146#if __has_builtin(__make_integer_seq)
147 template<
typename,
size_t... _Indices>
148 using _IdxTuple = _Index_tuple<_Indices...>;
151 using __type = __make_integer_seq<_IdxTuple, size_t, _Num>;
154 using __type = _Index_tuple<__integer_pack(_Num)...>;
158#if __cplusplus >= 201402L
160#define __cpp_lib_integer_sequence 201304L
163 template<
typename _Tp, _Tp... _Idx>
166 typedef _Tp value_type;
167 static constexpr size_t size()
noexcept {
return sizeof...(_Idx); }
171 template<
typename _Tp, _Tp _Num>
173#if __has_builtin(__make_integer_seq)
174 = __make_integer_seq<integer_sequence, _Tp, _Num>;
180 template<
size_t... _Idx>
184 template<
size_t _Num>
188 template<
typename... _Types>
191#if __cplusplus >= 201703L
194 explicit in_place_t() =
default;
197 inline constexpr in_place_t in_place{};
199 template<
typename _Tp>
struct in_place_type_t
201 explicit in_place_type_t() =
default;
204 template<
typename _Tp>
205 inline constexpr in_place_type_t<_Tp> in_place_type{};
207 template<
size_t _Idx>
struct in_place_index_t
209 explicit in_place_index_t() =
default;
212 template<
size_t _Idx>
213 inline constexpr in_place_index_t<_Idx> in_place_index{};
216 inline constexpr bool __is_in_place_type_v =
false;
218 template<
typename _Tp>
219 inline constexpr bool __is_in_place_type_v<in_place_type_t<_Tp>> =
true;
221 template<
typename _Tp>
222 using __is_in_place_type = bool_constant<__is_in_place_type_v<_Tp>>;
227 template<
size_t _Np,
typename... _Types>
231 template<
typename _Tp0,
typename... _Rest>
232 struct _Nth_type<0, _Tp0, _Rest...>
233 {
using type = _Tp0; };
235 template<
typename _Tp0,
typename _Tp1,
typename... _Rest>
236 struct _Nth_type<1, _Tp0, _Tp1, _Rest...>
237 {
using type = _Tp1; };
239 template<
typename _Tp0,
typename _Tp1,
typename _Tp2,
typename... _Rest>
240 struct _Nth_type<2, _Tp0, _Tp1, _Tp2, _Rest...>
241 {
using type = _Tp2; };
243 template<
size_t _Np,
typename _Tp0,
typename _Tp1,
typename _Tp2,
248 struct _Nth_type<_Np, _Tp0, _Tp1, _Tp2, _Rest...>
249 : _Nth_type<_Np - 3, _Rest...>
253 template<
typename _Tp0,
typename _Tp1,
typename... _Rest>
254 struct _Nth_type<0, _Tp0, _Tp1, _Rest...>
255 {
using type = _Tp0; };
257 template<
typename _Tp0,
typename _Tp1,
typename _Tp2,
typename... _Rest>
258 struct _Nth_type<0, _Tp0, _Tp1, _Tp2, _Rest...>
259 {
using type = _Tp0; };
261 template<
typename _Tp0,
typename _Tp1,
typename _Tp2,
typename... _Rest>
262 struct _Nth_type<1, _Tp0, _Tp1, _Tp2, _Rest...>
263 {
using type = _Tp1; };
266_GLIBCXX_END_NAMESPACE_VERSION
ISO C++ entities toplevel namespace is std.
make_integer_sequence< size_t, _Num > make_index_sequence
Alias template make_index_sequence.
__make_integer_seq< integer_sequence, _Tp, _Num > make_integer_sequence
Alias template make_integer_sequence.
make_index_sequence< sizeof...(_Types)> index_sequence_for
Alias template index_sequence_for.
Define a member typedef type only if a boolean constant is true.
Finds the size of a given tuple type.
Gives the type of the ith element of a given tuple type.
Class template integer_sequence.