30#ifndef _GLIBCXX_CONCEPTS
31#define _GLIBCXX_CONCEPTS 1
33#if __cplusplus > 201703L && __cpp_concepts >= 201907L
35#pragma GCC system_header
46namespace std _GLIBCXX_VISIBILITY(default)
48_GLIBCXX_BEGIN_NAMESPACE_VERSION
50#define __cpp_lib_concepts 202002L
56 template<
typename _Tp,
typename _Up>
57 concept __same_as = std::is_same_v<_Tp, _Up>;
61 template<
typename _Tp,
typename _Up>
63 = __detail::__same_as<_Tp, _Up> && __detail::__same_as<_Up, _Tp>;
66 template<
typename _Derived,
typename _Base>
68 && is_convertible_v<const volatile _Derived*, const volatile _Base*>;
71 template<
typename _From,
typename _To>
73 &&
requires {
static_cast<_To
>(std::declval<_From>()); };
76 template<
typename _Tp,
typename _Up>
83 template<
typename _Tp,
typename _Up>
87 static_cast<common_type_t<_Tp, _Up>
>(std::declval<_Tp>());
88 static_cast<common_type_t<_Tp, _Up>
>(std::declval<_Up>());
99 template<
typename _Tp>
100 concept integral = is_integral_v<_Tp>;
102 template<
typename _Tp>
103 concept signed_integral = integral<_Tp> && is_signed_v<_Tp>;
105 template<
typename _Tp>
106 concept unsigned_integral = integral<_Tp> && !signed_integral<_Tp>;
108 template<
typename _Tp>
109 concept floating_point = is_floating_point_v<_Tp>;
113 template<
typename _Tp>
116 template<
typename _Tp>
117 concept __class_or_enum
118 = is_class_v<_Tp> || is_union_v<_Tp> || is_enum_v<_Tp>;
120 template<
typename _Tp>
121 constexpr bool __destructible_impl =
false;
122 template<
typename _Tp>
123 requires requires(_Tp& __t) { { __t.~_Tp() }
noexcept; }
124 constexpr bool __destructible_impl<_Tp> =
true;
126 template<
typename _Tp>
127 constexpr bool __destructible = __destructible_impl<_Tp>;
128 template<
typename _Tp>
129 constexpr bool __destructible<_Tp&> =
true;
130 template<
typename _Tp>
131 constexpr bool __destructible<_Tp&&> =
true;
132 template<
typename _Tp,
size_t _Nm>
133 constexpr bool __destructible<_Tp[_Nm]> = __destructible<_Tp>;
138 template<
typename _Lhs,
typename _Rhs>
140 = is_lvalue_reference_v<_Lhs>
142 &&
requires(_Lhs __lhs, _Rhs&& __rhs) {
147 template<
typename _Tp>
151 template<
typename _Tp,
typename... _Args>
156 template<
typename _Tp>
165 template<
typename _Tp>
170 template<
typename _Tp>
181 namespace __cust_swap
183 template<
typename _Tp>
void swap(_Tp&, _Tp&) =
delete;
185 template<
typename _Tp,
typename _Up>
187 = (__detail::__class_or_enum<remove_reference_t<_Tp>>
188 || __detail::__class_or_enum<remove_reference_t<_Up>>)
189 &&
requires(_Tp&& __t, _Up&& __u) {
190 swap(
static_cast<_Tp&&
>(__t),
static_cast<_Up&&
>(__u));
196 template<
typename _Tp,
typename _Up>
197 static constexpr bool
200 if constexpr (__adl_swap<_Tp, _Up>)
201 return noexcept(
swap(std::declval<_Tp>(), std::declval<_Up>()));
203 return is_nothrow_move_constructible_v<remove_reference_t<_Tp>>
204 && is_nothrow_move_assignable_v<remove_reference_t<_Tp>>;
208 template<
typename _Tp,
typename _Up>
209 requires __adl_swap<_Tp, _Up>
214 operator()(_Tp&& __t, _Up&& __u)
const
215 noexcept(_S_noexcept<_Tp, _Up>())
217 if constexpr (__adl_swap<_Tp, _Up>)
218 swap(
static_cast<_Tp&&
>(__t),
static_cast<_Up&&
>(__u));
221 auto __tmp =
static_cast<remove_reference_t<_Tp>&&
>(__t);
222 __t =
static_cast<remove_reference_t<_Tp>&&
>(__u);
223 __u =
static_cast<remove_reference_t<_Tp>&&
>(__tmp);
227 template<
typename _Tp,
typename _Up,
size_t _Num>
228 requires requires(
const _Swap& __swap, _Tp& __e1, _Up& __e2) {
232 operator()(_Tp (&__e1)[_Num], _Up (&__e2)[_Num])
const
233 noexcept(
noexcept(std::declval<const _Swap&>()(*__e1, *__e2)))
235 for (
size_t __n = 0; __n < _Num; ++__n)
236 (*
this)(__e1[__n], __e2[__n]);
241 inline namespace __cust
243 inline constexpr __cust_swap::_Swap
swap{};
247 template<
typename _Tp>
249 =
requires(_Tp& __a, _Tp& __b) {
ranges::swap(__a, __b); };
251 template<
typename _Tp,
typename _Up>
252 concept swappable_with = common_reference_with<_Tp, _Up>
253 &&
requires(_Tp&& __t, _Up&& __u) {
254 ranges::swap(
static_cast<_Tp&&
>(__t),
static_cast<_Tp&&
>(__t));
255 ranges::swap(
static_cast<_Up&&
>(__u),
static_cast<_Up&&
>(__u));
256 ranges::swap(
static_cast<_Tp&&
>(__t),
static_cast<_Up&&
>(__u));
257 ranges::swap(
static_cast<_Up&&
>(__u),
static_cast<_Tp&&
>(__t));
262 template<
typename _Tp>
263 concept movable = is_object_v<_Tp> && move_constructible<_Tp>
264 && assignable_from<_Tp&, _Tp> && swappable<_Tp>;
266 template<
typename _Tp>
267 concept copyable = copy_constructible<_Tp> && movable<_Tp>
268 && assignable_from<_Tp&, _Tp&> && assignable_from<_Tp&, const _Tp&>
269 && assignable_from<_Tp&, const _Tp>;
271 template<
typename _Tp>
272 concept semiregular = copyable<_Tp> && default_initializable<_Tp>;
279 template<
typename _Tp>
280 concept __boolean_testable_impl = convertible_to<_Tp, bool>;
282 template<
typename _Tp>
283 concept __boolean_testable
284 = __boolean_testable_impl<_Tp>
285 &&
requires(_Tp&& __t)
286 { { !
static_cast<_Tp&&
>(__t) } -> __boolean_testable_impl; };
293 template<
typename _Tp,
typename _Up>
294 concept __weakly_eq_cmp_with
295 =
requires(__detail::__cref<_Tp> __t, __detail::__cref<_Up> __u) {
296 { __t == __u } -> __boolean_testable;
297 { __t != __u } -> __boolean_testable;
298 { __u == __t } -> __boolean_testable;
299 { __u != __t } -> __boolean_testable;
303 template<
typename _Tp>
304 concept equality_comparable = __detail::__weakly_eq_cmp_with<_Tp, _Tp>;
306 template<
typename _Tp,
typename _Up>
307 concept equality_comparable_with
308 = equality_comparable<_Tp> && equality_comparable<_Up>
309 && common_reference_with<__detail::__cref<_Tp>, __detail::__cref<_Up>>
310 && equality_comparable<common_reference_t<__detail::__cref<_Tp>,
311 __detail::__cref<_Up>>>
312 && __detail::__weakly_eq_cmp_with<_Tp, _Up>;
316 template<
typename _Tp,
typename _Up>
317 concept __partially_ordered_with
318 =
requires(
const remove_reference_t<_Tp>& __t,
319 const remove_reference_t<_Up>& __u) {
320 { __t < __u } -> __boolean_testable;
321 { __t > __u } -> __boolean_testable;
322 { __t <= __u } -> __boolean_testable;
323 { __t >= __u } -> __boolean_testable;
324 { __u < __t } -> __boolean_testable;
325 { __u > __t } -> __boolean_testable;
326 { __u <= __t } -> __boolean_testable;
327 { __u >= __t } -> __boolean_testable;
332 template<
typename _Tp>
333 concept totally_ordered
334 = equality_comparable<_Tp>
335 && __detail::__partially_ordered_with<_Tp, _Tp>;
337 template<
typename _Tp,
typename _Up>
338 concept totally_ordered_with
339 = totally_ordered<_Tp> && totally_ordered<_Up>
340 && equality_comparable_with<_Tp, _Up>
341 && totally_ordered<common_reference_t<__detail::__cref<_Tp>,
342 __detail::__cref<_Up>>>
343 && __detail::__partially_ordered_with<_Tp, _Up>;
345 template<
typename _Tp>
346 concept regular = semiregular<_Tp> && equality_comparable<_Tp>;
351 template<
typename _Fn,
typename... _Args>
355 template<
typename _Fn,
typename... _Args>
359 template<
typename _Fn,
typename... _Args>
364 template<
typename _Rel,
typename _Tp,
typename _Up>
370 template<
typename _Rel,
typename _Tp,
typename _Up>
374 template<
typename _Rel,
typename _Tp,
typename _Up>
377_GLIBCXX_END_NAMESPACE_VERSION
typename remove_reference< _Tp >::type remove_reference_t
Alias template for remove_reference.
typename add_lvalue_reference< _Tp >::type add_lvalue_reference_t
Alias template for add_lvalue_reference.
typename invoke_result< _Fn, _Args... >::type invoke_result_t
std::invoke_result_t
void swap(any &__x, any &__y) noexcept
Exchange the states of two any objects.
ISO C++ entities toplevel namespace is std.
[concept.same], concept same_as
[concept.derived], concept derived_from
[concept.convertible], concept convertible_to
[concept.commonref], concept common_reference_with
[concept.common], concept common_with
[concept.assignable], concept assignable_from
[concept.destructible], concept destructible
[concept.constructible], concept constructible_from
[concept.defaultinitializable], concept default_initializable
[concept.moveconstructible], concept move_constructible
[concept.copyconstructible], concept copy_constructible
[concept.invocable], concept invocable
[concept.regularinvocable], concept regular_invocable
[concept.predicate], concept predicate
[concept.relation], concept relation
[concept.equiv], concept equivalence_relation
[concept.strictweakorder], concept strict_weak_order