1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef _LIBCPP___TUPLE_TUPLE_LIKE_NO_SUBRANGE_H
10 #define _LIBCPP___TUPLE_TUPLE_LIKE_NO_SUBRANGE_H
13 #include <__cstddef/size_t.h>
14 #include <__fwd/array.h>
15 #include <__fwd/complex.h>
16 #include <__fwd/pair.h>
17 #include <__fwd/tuple.h>
18 #include <__tuple/tuple_size.h>
19 #include <__type_traits/remove_cvref.h>
21 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
22 # pragma GCC system_header
25 _LIBCPP_BEGIN_NAMESPACE_STD
27 #if _LIBCPP_STD_VER >= 20
30 inline constexpr bool __tuple_like_no_subrange_impl
= false;
32 template <class... _Tp
>
33 inline constexpr bool __tuple_like_no_subrange_impl
<tuple
<_Tp
...>> = true;
35 template <class _T1
, class _T2
>
36 inline constexpr bool __tuple_like_no_subrange_impl
<pair
<_T1
, _T2
>> = true;
38 template <class _Tp
, size_t _Size
>
39 inline constexpr bool __tuple_like_no_subrange_impl
<array
<_Tp
, _Size
>> = true;
41 # if _LIBCPP_STD_VER >= 26
44 inline constexpr bool __tuple_like_no_subrange_impl
<complex<_Tp
>> = true;
49 concept __tuple_like_no_subrange
= __tuple_like_no_subrange_impl
<remove_cvref_t
<_Tp
>>;
51 // This is equivalent to the exposition-only type trait `pair-like`, except that it is false for specializations of
52 // `ranges::subrange`. This is more useful than the pair-like concept in the standard because every use of `pair-like`
53 // excludes `ranges::subrange`.
55 concept __pair_like_no_subrange
= __tuple_like_no_subrange
<_Tp
> && tuple_size
<remove_cvref_t
<_Tp
>>::value
== 2;
57 #endif // _LIBCPP_STD_VER >= 20
59 _LIBCPP_END_NAMESPACE_STD
61 #endif // _LIBCPP___TUPLE_TUPLE_LIKE_NO_SUBRANGE_H