33#ifndef _GLIBCXX_UTILITY_H
34#define _GLIBCXX_UTILITY_H 1
37#pragma GCC system_header
40#if __cplusplus >= 201103L
45namespace std _GLIBCXX_VISIBILITY(default)
47_GLIBCXX_BEGIN_NAMESPACE_VERSION
50 template<
typename _Tp>
57 template<
typename _Tp,
58 typename _Up =
typename remove_cv<_Tp>::type,
61 using __enable_if_has_tuple_size = _Tp;
63 template<
typename _Tp>
64 struct tuple_size<const __enable_if_has_tuple_size<_Tp>>
67 template<
typename _Tp>
68 struct tuple_size<volatile __enable_if_has_tuple_size<_Tp>>
71 template<
typename _Tp>
72 struct tuple_size<const volatile __enable_if_has_tuple_size<_Tp>>
73 :
public tuple_size<_Tp> { };
75#if __cplusplus >= 201703L
76 template<
typename _Tp>
77 inline constexpr size_t tuple_size_v = tuple_size<_Tp>::value;
81 template<
size_t __i,
typename _Tp>
85 template<
size_t __i,
typename _Tp>
88 template<
size_t __i,
typename _Tp>
91 using type =
const __tuple_element_t<__i, _Tp>;
94 template<
size_t __i,
typename _Tp>
97 using type =
volatile __tuple_element_t<__i, _Tp>;
100 template<
size_t __i,
typename _Tp>
101 struct tuple_element<__i, const volatile _Tp>
103 using type =
const volatile __tuple_element_t<__i, _Tp>;
106#if __cplusplus >= 201402L
110 template<
typename _Tp,
typename... _Types>
112 __find_uniq_type_in_pack()
114 constexpr size_t __sz =
sizeof...(_Types);
115 constexpr bool __found[__sz] = { __is_same(_Tp, _Types) ... };
117 for (
size_t __i = 0; __i < __sz; ++__i)
135#ifdef __glibcxx_tuple_element_t
136 template<
size_t __i,
typename _Tp>
137 using tuple_element_t =
typename tuple_element<__i, _Tp>::type;
142 template<
size_t... _Indexes>
struct _Index_tuple { };
145 template<
size_t _Num>
146 struct _Build_index_tuple
148#if __has_builtin(__make_integer_seq)
149 template<
typename,
size_t... _Indices>
150 using _IdxTuple = _Index_tuple<_Indices...>;
153 using __type = __make_integer_seq<_IdxTuple, size_t, _Num>;
156 using __type = _Index_tuple<__integer_pack(_Num)...>;
160#ifdef __glibcxx_integer_sequence
163 template<
typename _Tp, _Tp... _Idx>
166#if __cplusplus >= 202002L
167 static_assert(is_integral_v<_Tp>);
169 typedef _Tp value_type;
170 static constexpr size_t size()
noexcept {
return sizeof...(_Idx); }
174 template<
typename _Tp, _Tp _Num>
176#if __has_builtin(__make_integer_seq)
177 = __make_integer_seq<integer_sequence, _Tp, _Num>;
183 template<
size_t... _Idx>
187 template<
size_t _Num>
191 template<
typename... _Types>
195#if __cplusplus >= 201703L
198 explicit in_place_t() =
default;
201 inline constexpr in_place_t in_place{};
203 template<
typename _Tp>
struct in_place_type_t
205 explicit in_place_type_t() =
default;
208 template<
typename _Tp>
209 inline constexpr in_place_type_t<_Tp> in_place_type{};
211 template<
size_t _Idx>
struct in_place_index_t
213 explicit in_place_index_t() =
default;
216 template<
size_t _Idx>
217 inline constexpr in_place_index_t<_Idx> in_place_index{};
220 inline constexpr bool __is_in_place_type_v =
false;
222 template<
typename _Tp>
223 inline constexpr bool __is_in_place_type_v<in_place_type_t<_Tp>> =
true;
226 inline constexpr bool __is_in_place_index_v =
false;
229 inline constexpr bool __is_in_place_index_v<in_place_index_t<_Nm>> =
true;
233#if _GLIBCXX_USE_BUILTIN_TRAIT(__type_pack_element)
234 template<
size_t _Np,
typename... _Types>
236 {
using type = __type_pack_element<_Np, _Types...>; };
238 template<
size_t _Np,
typename... _Types>
242 template<
typename _Tp0,
typename... _Rest>
243 struct _Nth_type<0, _Tp0, _Rest...>
244 {
using type = _Tp0; };
246 template<
typename _Tp0,
typename _Tp1,
typename... _Rest>
247 struct _Nth_type<1, _Tp0, _Tp1, _Rest...>
248 {
using type = _Tp1; };
250 template<
typename _Tp0,
typename _Tp1,
typename _Tp2,
typename... _Rest>
251 struct _Nth_type<2, _Tp0, _Tp1, _Tp2, _Rest...>
252 {
using type = _Tp2; };
254 template<
size_t _Np,
typename _Tp0,
typename _Tp1,
typename _Tp2,
259 struct _Nth_type<_Np, _Tp0, _Tp1, _Tp2, _Rest...>
260 : _Nth_type<_Np - 3, _Rest...>
264 template<
typename _Tp0,
typename _Tp1,
typename _Tp2,
typename... _Rest>
265 struct _Nth_type<0, _Tp0, _Tp1, _Tp2, _Rest...>
266 {
using type = _Tp0; };
268 template<
typename _Tp0,
typename _Tp1,
typename _Tp2,
typename... _Rest>
269 struct _Nth_type<1, _Tp0, _Tp1, _Tp2, _Rest...>
270 {
using type = _Tp1; };
275 namespace ranges::__detail
277 template<
typename _Range>
278 inline constexpr bool __is_subrange =
false;
284 struct _Swallow_assign
287 constexpr const _Swallow_assign&
288 operator=(
const _Tp&)
const noexcept
309 _GLIBCXX17_INLINE
constexpr _Swallow_assign
ignore{};
311_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.
constexpr _Swallow_assign ignore
__make_integer_seq< integer_sequence, _Tp, _Num > make_integer_sequence
Alias template make_integer_sequence.
integer_sequence< size_t, _Idx... > index_sequence
Alias template index_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.