30#ifndef _GLIBCXX_CONCEPTS
31#define _GLIBCXX_CONCEPTS 1
34#pragma GCC system_header
37#define __glibcxx_want_concepts
40#ifdef __cpp_lib_concepts
50namespace std _GLIBCXX_VISIBILITY(default)
52_GLIBCXX_BEGIN_NAMESPACE_VERSION
58 template<
typename _Tp,
typename _Up>
59 concept __same_as = std::is_same_v<_Tp, _Up>;
63 template<
typename _Tp,
typename _Up>
65 = __detail::__same_as<_Tp, _Up> && __detail::__same_as<_Up, _Tp>;
69 template<
typename _Tp,
typename _Up>
70 concept __different_from
75 template<
typename _Derived,
typename _Base>
77 && is_convertible_v<const volatile _Derived*, const volatile _Base*>;
80 template<
typename _From,
typename _To>
85 template<
typename _Tp,
typename _Up>
92 template<
typename _Tp,
typename _Up>
108 template<
typename _Tp>
109 concept integral = is_integral_v<_Tp>;
111 template<
typename _Tp>
112 concept signed_integral = integral<_Tp> && is_signed_v<_Tp>;
114 template<
typename _Tp>
115 concept unsigned_integral = integral<_Tp> && !signed_integral<_Tp>;
117 template<
typename _Tp>
118 concept floating_point = is_floating_point_v<_Tp>;
122 template<
typename _Tp>
125 template<
typename _Tp>
126 concept __class_or_enum
127 = is_class_v<_Tp> || is_union_v<_Tp> || is_enum_v<_Tp>;
129 template<
typename _Tp>
130 constexpr bool __destructible_impl =
false;
131 template<
typename _Tp>
132 requires requires(_Tp& __t) { { __t.~_Tp() }
noexcept; }
133 constexpr bool __destructible_impl<_Tp> =
true;
135 template<
typename _Tp>
136 constexpr bool __destructible = __destructible_impl<_Tp>;
137 template<
typename _Tp>
138 constexpr bool __destructible<_Tp&> =
true;
139 template<
typename _Tp>
140 constexpr bool __destructible<_Tp&&> =
true;
141 template<
typename _Tp,
size_t _Nm>
142 constexpr bool __destructible<_Tp[_Nm]> = __destructible<_Tp>;
147 template<
typename _Lhs,
typename _Rhs>
149 = is_lvalue_reference_v<_Lhs>
151 &&
requires(_Lhs __lhs, _Rhs&& __rhs) {
156 template<
typename _Tp>
160 template<
typename _Tp,
typename... _Args>
165 template<
typename _Tp>
174 template<
typename _Tp>
179 template<
typename _Tp>
193 template<
typename _Tp>
void swap(_Tp&, _Tp&) =
delete;
195 template<
typename _Tp,
typename _Up>
197 = (std::__detail::__class_or_enum<remove_reference_t<_Tp>>
198 || std::__detail::__class_or_enum<remove_reference_t<_Up>>)
199 &&
requires(_Tp&& __t, _Up&& __u) {
200 swap(
static_cast<_Tp&&
>(__t),
static_cast<_Up&&
>(__u));
206 template<
typename _Tp,
typename _Up>
207 static consteval bool
210 if constexpr (__adl_swap<_Tp, _Up>)
213 return is_nothrow_move_constructible_v<remove_reference_t<_Tp>>
214 && is_nothrow_move_assignable_v<remove_reference_t<_Tp>>;
218 template<
typename _Tp,
typename _Up>
219 requires __adl_swap<_Tp, _Up>
224 operator()(_Tp&& __t, _Up&& __u)
const
225 noexcept(_S_noexcept<_Tp, _Up>())
227 if constexpr (__adl_swap<_Tp, _Up>)
228 swap(
static_cast<_Tp&&
>(__t),
static_cast<_Up&&
>(__u));
237 template<
typename _Tp,
typename _Up,
size_t _Num>
238 requires requires(
const _Swap& __swap, _Tp& __e1, _Up& __e2) {
242 operator()(_Tp (&__e1)[_Num], _Up (&__e2)[_Num])
const
245 for (
size_t __n = 0; __n < _Num; ++__n)
246 (*
this)(__e1[__n], __e2[__n]);
252 inline namespace _Cpo {
253 inline constexpr __swap::_Swap swap{};
257 template<
typename _Tp>
259 =
requires(_Tp& __a, _Tp& __b) { ranges::swap(__a, __b); };
261 template<
typename _Tp,
typename _Up>
262 concept swappable_with = common_reference_with<_Tp, _Up>
263 &&
requires(_Tp&& __t, _Up&& __u) {
264 ranges::swap(
static_cast<_Tp&&
>(__t),
static_cast<_Tp&&
>(__t));
265 ranges::swap(
static_cast<_Up&&
>(__u),
static_cast<_Up&&
>(__u));
266 ranges::swap(
static_cast<_Tp&&
>(__t),
static_cast<_Up&&
>(__u));
267 ranges::swap(
static_cast<_Up&&
>(__u),
static_cast<_Tp&&
>(__t));
272 template<
typename _Tp>
276 template<
typename _Tp>
281 template<
typename _Tp>
289 template<
typename _Tp>
290 concept __boolean_testable_impl = convertible_to<_Tp, bool>;
292 template<
typename _Tp>
293 concept __boolean_testable
294 = __boolean_testable_impl<_Tp>
295 &&
requires(_Tp&& __t)
296 { { !
static_cast<_Tp&&
>(__t) } -> __boolean_testable_impl; };
302 template<
typename _Tp,
typename _Up,
304 concept __comparison_common_type_with_impl
305 = same_as<common_reference_t<const _Tp&, const _Up&>,
308 requires convertible_to<const _Tp&, const _Cref&>
309 || convertible_to<_Tp, const _Cref&>;
310 requires convertible_to<const _Up&, const _Cref&>
311 || convertible_to<_Up, const _Cref&>;
314 template<
typename _Tp,
typename _Up>
315 concept __comparison_common_type_with
316 = __comparison_common_type_with_impl<remove_cvref_t<_Tp>,
317 remove_cvref_t<_Up>>;
324 template<
typename _Tp,
typename _Up>
325 concept __weakly_eq_cmp_with
326 =
requires(__detail::__cref<_Tp> __t, __detail::__cref<_Up> __u) {
327 { __t == __u } -> __boolean_testable;
328 { __t != __u } -> __boolean_testable;
329 { __u == __t } -> __boolean_testable;
330 { __u != __t } -> __boolean_testable;
334 template<
typename _Tp>
335 concept equality_comparable = __detail::__weakly_eq_cmp_with<_Tp, _Tp>;
337 template<
typename _Tp,
typename _Up>
338 concept equality_comparable_with
339 = equality_comparable<_Tp> && equality_comparable<_Up>
340 && __detail::__comparison_common_type_with<_Tp, _Up>
341 && equality_comparable<common_reference_t<__detail::__cref<_Tp>,
342 __detail::__cref<_Up>>>
343 && __detail::__weakly_eq_cmp_with<_Tp, _Up>;
347 template<
typename _Tp,
typename _Up>
348 concept __partially_ordered_with
351 { __t < __u } -> __boolean_testable;
352 { __t > __u } -> __boolean_testable;
353 { __t <= __u } -> __boolean_testable;
354 { __t >= __u } -> __boolean_testable;
355 { __u < __t } -> __boolean_testable;
356 { __u > __t } -> __boolean_testable;
357 { __u <= __t } -> __boolean_testable;
358 { __u >= __t } -> __boolean_testable;
363 template<
typename _Tp>
364 concept totally_ordered
365 = equality_comparable<_Tp>
366 && __detail::__partially_ordered_with<_Tp, _Tp>;
368 template<
typename _Tp,
typename _Up>
369 concept totally_ordered_with
370 = totally_ordered<_Tp> && totally_ordered<_Up>
371 && equality_comparable_with<_Tp, _Up>
372 && totally_ordered<common_reference_t<__detail::__cref<_Tp>,
373 __detail::__cref<_Up>>>
374 && __detail::__partially_ordered_with<_Tp, _Up>;
376 template<
typename _Tp>
377 concept regular = semiregular<_Tp> && equality_comparable<_Tp>;
382 template<
typename _Fn,
typename... _Args>
386 template<
typename _Fn,
typename... _Args>
390 template<
typename _Fn,
typename... _Args>
392 && __detail::__boolean_testable<invoke_result_t<_Fn, _Args...>>;
395 template<
typename _Rel,
typename _Tp,
typename _Up>
401 template<
typename _Rel,
typename _Tp,
typename _Up>
405 template<
typename _Rel,
typename _Tp,
typename _Up>
408_GLIBCXX_END_NAMESPACE_VERSION
typename common_reference< _Tp... >::type common_reference_t
typename add_lvalue_reference< _Tp >::type add_lvalue_reference_t
Alias template for add_lvalue_reference.
typename remove_reference< _Tp >::type remove_reference_t
Alias template for remove_reference.
typename common_type< _Tp... >::type common_type_t
Alias template for common_type.
auto declval() noexcept -> decltype(__declval< _Tp >(0))
ISO C++ entities toplevel namespace is std.
Implementation details not part of the namespace std interface.
[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