tuple_like.h 1.4 KB

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