xref: /freebsd/contrib/llvm-project/libcxx/include/__tuple/tuple_like.h (revision e9ac41698b2f322d55ccf9da50a3596edb2c1800)
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_H
10 #define _LIBCPP___TUPLE_TUPLE_LIKE_H
11 
12 #include <__config>
13 #include <__fwd/array.h>
14 #include <__fwd/pair.h>
15 #include <__fwd/subrange.h>
16 #include <__fwd/tuple.h>
17 #include <__type_traits/integral_constant.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 struct __tuple_like_impl : false_type {};
31 
32 template <class... _Tp>
33 struct __tuple_like_impl<tuple<_Tp...> > : true_type {};
34 
35 template <class _T1, class _T2>
36 struct __tuple_like_impl<pair<_T1, _T2> > : true_type {};
37 
38 template <class _Tp, size_t _Size>
39 struct __tuple_like_impl<array<_Tp, _Size> > : true_type {};
40 
41 template <class _Ip, class _Sp, ranges::subrange_kind _Kp>
42 struct __tuple_like_impl<ranges::subrange<_Ip, _Sp, _Kp> > : true_type {};
43 
44 template <class _Tp>
45 concept __tuple_like = __tuple_like_impl<remove_cvref_t<_Tp>>::value;
46 
47 #endif // _LIBCPP_STD_VER >= 20
48 
49 _LIBCPP_END_NAMESPACE_STD
50 
51 #endif // _LIBCPP___TUPLE_TUPLE_LIKE_H
52