Debian Codegraph @

libcxx/include/__tuple/tuple_like_no_subrange.h

raw
1 //===----------------------------------------------------------------------===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8
9 #ifndef _LIBCPP___TUPLE_TUPLE_LIKE_NO_SUBRANGE_H
10 #define _LIBCPP___TUPLE_TUPLE_LIKE_NO_SUBRANGE_H
11
12 #include <__config>
13 #include <__fwd/array.h>
14 #include <__fwd/complex.h>
15 #include <__fwd/pair.h>
16 #include <__fwd/tuple.h>
17 #include <__tuple/tuple_size.h>
18 #include <__type_traits/remove_cvref.h>
19 #include <cstddef>
20
21 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
22 # pragma GCC system_header
23 #endif
24
25 _LIBCPP_BEGIN_NAMESPACE_STD
26
27 #if _LIBCPP_STD_VER >= 20
28
29 template <class _Tp>
30 inline constexpr bool __tuple_like_no_subrange_impl = false;
31
32 template <class... _Tp>
33 inline constexpr bool __tuple_like_no_subrange_impl<tuple<_Tp...>> = true;
34
35 template <class _T1, class _T2>
36 inline constexpr bool __tuple_like_no_subrange_impl<pair<_T1, _T2>> = true;
37
38 template <class _Tp, size_t _Size>
39 inline constexpr bool __tuple_like_no_subrange_impl<array<_Tp, _Size>> = true;
40
41 # if _LIBCPP_STD_VER >= 26
42
43 template <class _Tp>
44 inline constexpr bool __tuple_like_no_subrange_impl<complex<_Tp>> = true;
45
46 # endif
47
48 template <class _Tp>
49 concept __tuple_like_no_subrange = __tuple_like_no_subrange_impl<remove_cvref_t<_Tp>>;
50
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`.
54 template <class _Tp>
55 concept __pair_like_no_subrange = __tuple_like_no_subrange<_Tp> && tuple_size<remove_cvref_t<_Tp>>::value == 2;
56
57 #endif // _LIBCPP_STD_VER >= 20
58
59 _LIBCPP_END_NAMESPACE_STD
60
61 #endif // _LIBCPP___TUPLE_TUPLE_LIKE_NO_SUBRANGE_H