diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2022-01-27 22:17:16 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2022-06-04 11:59:19 +0000 |
| commit | 390adc38fc112be360bd15499e5241bf4e675b6f (patch) | |
| tree | 712d68d3aa03f7aa4902ba03dcac2a56f49ae0e5 /contrib/llvm-project/libcxx/include/__ranges/concepts.h | |
| parent | 8a84287b0edc66fc6dede3db770d10ff41da5464 (diff) | |
Diffstat (limited to 'contrib/llvm-project/libcxx/include/__ranges/concepts.h')
| -rw-r--r-- | contrib/llvm-project/libcxx/include/__ranges/concepts.h | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/contrib/llvm-project/libcxx/include/__ranges/concepts.h b/contrib/llvm-project/libcxx/include/__ranges/concepts.h index bad23c8c4bfb..a9cb15f9f17c 100644 --- a/contrib/llvm-project/libcxx/include/__ranges/concepts.h +++ b/contrib/llvm-project/libcxx/include/__ranges/concepts.h @@ -9,6 +9,9 @@ #ifndef _LIBCPP___RANGES_CONCEPTS_H #define _LIBCPP___RANGES_CONCEPTS_H +#include <__concepts/constructible.h> +#include <__concepts/movable.h> +#include <__concepts/same_as.h> #include <__config> #include <__iterator/concepts.h> #include <__iterator/incrementable_traits.h> @@ -20,7 +23,7 @@ #include <__ranges/enable_borrowed_range.h> #include <__ranges/enable_view.h> #include <__ranges/size.h> -#include <concepts> +#include <initializer_list> #include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -80,11 +83,11 @@ namespace ranges { movable<_Tp> && enable_view<_Tp>; - template<class _Range> + template <class _Range> concept __simple_view = view<_Range> && range<const _Range> && same_as<iterator_t<_Range>, iterator_t<const _Range>> && - same_as<sentinel_t<_Range>, iterator_t<const _Range>>; + same_as<sentinel_t<_Range>, sentinel_t<const _Range>>; // [range.refinements], other range refinements template <class _Rp, class _Tp> @@ -114,12 +117,20 @@ namespace ranges { template <class _Tp> concept common_range = range<_Tp> && same_as<iterator_t<_Tp>, sentinel_t<_Tp>>; - template<class _Tp> + template <class _Tp> + inline constexpr bool __is_std_initializer_list = false; + + template <class _Ep> + inline constexpr bool __is_std_initializer_list<initializer_list<_Ep>> = true; + + template <class _Tp> concept viewable_range = - range<_Tp> && ( - (view<remove_cvref_t<_Tp>> && constructible_from<remove_cvref_t<_Tp>, _Tp>) || - (!view<remove_cvref_t<_Tp>> && borrowed_range<_Tp>) - ); + range<_Tp> && + ((view<remove_cvref_t<_Tp>> && constructible_from<remove_cvref_t<_Tp>, _Tp>) || + (!view<remove_cvref_t<_Tp>> && + (is_lvalue_reference_v<_Tp> || + (movable<remove_reference_t<_Tp>> && !__is_std_initializer_list<remove_cvref_t<_Tp>>)))); + } // namespace ranges #endif // !defined(_LIBCPP_HAS_NO_RANGES) |
