| 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/subrange.h> |
| 14 | #include <__tuple/tuple_like_no_subrange.h> |
| 15 | #include <__tuple/tuple_size.h> |
| 16 | #include <__type_traits/remove_cvref.h> |
| 17 | |
| 18 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 19 | # pragma GCC system_header |
| 20 | #endif |
| 21 | |
| 22 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 23 | |
| 24 | #if _LIBCPP_STD_VER >= 20 |
| 25 | |
| 26 | template <class _Tp> |
| 27 | inline constexpr bool __is_ranges_subrange_v = false; |
| 28 | |
| 29 | template <class _Iter, class _Sent, ranges::subrange_kind _Kind> |
| 30 | inline constexpr bool __is_ranges_subrange_v<ranges::subrange<_Iter, _Sent, _Kind>> = true; |
| 31 | |
| 32 | template <class _Tp> |
| 33 | concept __tuple_like = __tuple_like_no_subrange<_Tp> || __is_ranges_subrange_v<remove_cvref_t<_Tp>>; |
| 34 | |
| 35 | // As of writing this comment every use of `pair-like` in the standard excludes `ranges::subrange`, so |
| 36 | // you most likely want to use `__pair_like_no_subrange` if you're looking for `pair-like`. |
| 37 | |
| 38 | #endif // _LIBCPP_STD_VER >= 20 |
| 39 | |
| 40 | _LIBCPP_END_NAMESPACE_STD |
| 41 | |
| 42 | #endif // _LIBCPP___TUPLE_TUPLE_LIKE_H |
| 43 | |