diff options
Diffstat (limited to 'libcxx/include/__ranges')
-rw-r--r-- | libcxx/include/__ranges/access.h | 51 | ||||
-rw-r--r-- | libcxx/include/__ranges/all.h | 8 | ||||
-rw-r--r-- | libcxx/include/__ranges/concepts.h | 27 | ||||
-rw-r--r-- | libcxx/include/__ranges/data.h | 51 | ||||
-rw-r--r-- | libcxx/include/__ranges/empty.h | 9 | ||||
-rw-r--r-- | libcxx/include/__ranges/empty_view.h | 4 | ||||
-rw-r--r-- | libcxx/include/__ranges/enable_view.h | 12 | ||||
-rw-r--r-- | libcxx/include/__ranges/owning_view.h | 81 | ||||
-rw-r--r-- | libcxx/include/__ranges/ref_view.h | 3 | ||||
-rw-r--r-- | libcxx/include/__ranges/single_view.h | 2 | ||||
-rw-r--r-- | libcxx/include/__ranges/size.h | 10 | ||||
-rw-r--r-- | libcxx/include/__ranges/subrange.h | 10 | ||||
-rw-r--r-- | libcxx/include/__ranges/transform_view.h | 4 | ||||
-rw-r--r-- | libcxx/include/__ranges/view_interface.h | 3 |
14 files changed, 210 insertions, 65 deletions
diff --git a/libcxx/include/__ranges/access.h b/libcxx/include/__ranges/access.h index 91dc3055c86d..0b9470fa4017 100644 --- a/libcxx/include/__ranges/access.h +++ b/libcxx/include/__ranges/access.h @@ -9,6 +9,7 @@ #ifndef _LIBCPP___RANGES_ACCESS_H #define _LIBCPP___RANGES_ACCESS_H +#include <__concepts/class_or_enum.h> #include <__config> #include <__iterator/concepts.h> #include <__iterator/readable_traits.h> @@ -39,6 +40,7 @@ namespace __begin { template <class _Tp> concept __member_begin = __can_borrow<_Tp> && + __workaround_52970<_Tp> && requires(_Tp&& __t) { { _LIBCPP_AUTO_CAST(__t.begin()) } -> input_or_output_iterator; }; @@ -102,6 +104,7 @@ namespace __end { template <class _Tp> concept __member_end = __can_borrow<_Tp> && + __workaround_52970<_Tp> && requires(_Tp&& __t) { typename iterator_t<_Tp>; { _LIBCPP_AUTO_CAST(__t.end()) } -> sentinel_for<iterator_t<_Tp>>; @@ -160,20 +163,20 @@ namespace ranges { namespace __cbegin { struct __fn { template <class _Tp> - requires invocable<decltype(ranges::begin), _Tp const&> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp& __t) const - noexcept(noexcept(ranges::begin(_VSTD::as_const(__t)))) - { - return ranges::begin(_VSTD::as_const(__t)); - } + requires is_lvalue_reference_v<_Tp&&> + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI + constexpr auto operator()(_Tp&& __t) const + noexcept(noexcept(ranges::begin(static_cast<const remove_reference_t<_Tp>&>(__t)))) + -> decltype( ranges::begin(static_cast<const remove_reference_t<_Tp>&>(__t))) + { return ranges::begin(static_cast<const remove_reference_t<_Tp>&>(__t)); } template <class _Tp> - requires is_rvalue_reference_v<_Tp> && invocable<decltype(ranges::begin), _Tp const&&> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const - noexcept(noexcept(ranges::begin(static_cast<_Tp const&&>(__t)))) - { - return ranges::begin(static_cast<_Tp const&&>(__t)); - } + requires is_rvalue_reference_v<_Tp&&> + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI + constexpr auto operator()(_Tp&& __t) const + noexcept(noexcept(ranges::begin(static_cast<const _Tp&&>(__t)))) + -> decltype( ranges::begin(static_cast<const _Tp&&>(__t))) + { return ranges::begin(static_cast<const _Tp&&>(__t)); } }; } @@ -188,20 +191,20 @@ namespace ranges { namespace __cend { struct __fn { template <class _Tp> - requires invocable<decltype(ranges::end), _Tp const&> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp& __t) const - noexcept(noexcept(ranges::end(_VSTD::as_const(__t)))) - { - return ranges::end(_VSTD::as_const(__t)); - } + requires is_lvalue_reference_v<_Tp&&> + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI + constexpr auto operator()(_Tp&& __t) const + noexcept(noexcept(ranges::end(static_cast<const remove_reference_t<_Tp>&>(__t)))) + -> decltype( ranges::end(static_cast<const remove_reference_t<_Tp>&>(__t))) + { return ranges::end(static_cast<const remove_reference_t<_Tp>&>(__t)); } template <class _Tp> - requires is_rvalue_reference_v<_Tp> && invocable<decltype(ranges::end), _Tp const&&> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const - noexcept(noexcept(ranges::end(static_cast<_Tp const&&>(__t)))) - { - return ranges::end(static_cast<_Tp const&&>(__t)); - } + requires is_rvalue_reference_v<_Tp&&> + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI + constexpr auto operator()(_Tp&& __t) const + noexcept(noexcept(ranges::end(static_cast<const _Tp&&>(__t)))) + -> decltype( ranges::end(static_cast<const _Tp&&>(__t))) + { return ranges::end(static_cast<const _Tp&&>(__t)); } }; } diff --git a/libcxx/include/__ranges/all.h b/libcxx/include/__ranges/all.h index ccc77258ba10..90327da81460 100644 --- a/libcxx/include/__ranges/all.h +++ b/libcxx/include/__ranges/all.h @@ -14,9 +14,9 @@ #include <__iterator/iterator_traits.h> #include <__ranges/access.h> #include <__ranges/concepts.h> +#include <__ranges/owning_view.h> #include <__ranges/range_adaptor.h> #include <__ranges/ref_view.h> -#include <__ranges/subrange.h> #include <__utility/auto_cast.h> #include <__utility/declval.h> #include <__utility/forward.h> @@ -56,12 +56,12 @@ namespace __all { template<class _Tp> requires (!ranges::view<decay_t<_Tp>> && !requires (_Tp&& __t) { ranges::ref_view{_VSTD::forward<_Tp>(__t)}; } && - requires (_Tp&& __t) { ranges::subrange{_VSTD::forward<_Tp>(__t)}; }) + requires (_Tp&& __t) { ranges::owning_view{_VSTD::forward<_Tp>(__t)}; }) [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const - noexcept(noexcept(ranges::subrange{_VSTD::forward<_Tp>(__t)})) + noexcept(noexcept(ranges::owning_view{_VSTD::forward<_Tp>(__t)})) { - return ranges::subrange{_VSTD::forward<_Tp>(__t)}; + return ranges::owning_view{_VSTD::forward<_Tp>(__t)}; } }; } diff --git a/libcxx/include/__ranges/concepts.h b/libcxx/include/__ranges/concepts.h index bad23c8c4bfb..a9cb15f9f17c 100644 --- a/libcxx/include/__ranges/concepts.h +++ b/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) diff --git a/libcxx/include/__ranges/data.h b/libcxx/include/__ranges/data.h index cc151c59f3d7..69dfd479c011 100644 --- a/libcxx/include/__ranges/data.h +++ b/libcxx/include/__ranges/data.h @@ -9,13 +9,13 @@ #ifndef _LIBCPP___RANGES_DATA_H #define _LIBCPP___RANGES_DATA_H +#include <__concepts/class_or_enum.h> #include <__config> #include <__iterator/concepts.h> #include <__iterator/iterator_traits.h> #include <__memory/pointer_traits.h> #include <__ranges/access.h> -#include <__utility/forward.h> -#include <concepts> +#include <__utility/auto_cast.h> #include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -35,34 +35,33 @@ namespace __data { template <class _Tp> concept __member_data = + __can_borrow<_Tp> && + __workaround_52970<_Tp> && requires(_Tp&& __t) { - { _VSTD::forward<_Tp>(__t) } -> __can_borrow; - { __t.data() } -> __ptr_to_object; + { _LIBCPP_AUTO_CAST(__t.data()) } -> __ptr_to_object; }; template <class _Tp> concept __ranges_begin_invocable = !__member_data<_Tp> && + __can_borrow<_Tp> && requires(_Tp&& __t) { - { _VSTD::forward<_Tp>(__t) } -> __can_borrow; - { ranges::begin(_VSTD::forward<_Tp>(__t)) } -> contiguous_iterator; + { ranges::begin(__t) } -> contiguous_iterator; }; struct __fn { template <__member_data _Tp> - requires __can_borrow<_Tp> _LIBCPP_HIDE_FROM_ABI - constexpr __ptr_to_object auto operator()(_Tp&& __t) const + constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(__t.data())) { return __t.data(); } template<__ranges_begin_invocable _Tp> - requires __can_borrow<_Tp> _LIBCPP_HIDE_FROM_ABI - constexpr __ptr_to_object auto operator()(_Tp&& __t) const - noexcept(noexcept(_VSTD::to_address(ranges::begin(_VSTD::forward<_Tp>(__t))))) { - return _VSTD::to_address(ranges::begin(_VSTD::forward<_Tp>(__t))); + constexpr auto operator()(_Tp&& __t) const + noexcept(noexcept(_VSTD::to_address(ranges::begin(__t)))) { + return _VSTD::to_address(ranges::begin(__t)); } }; } @@ -72,6 +71,34 @@ inline namespace __cpo { } // namespace __cpo } // namespace ranges +// [range.prim.cdata] + +namespace ranges { +namespace __cdata { + struct __fn { + template <class _Tp> + requires is_lvalue_reference_v<_Tp&&> + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI + constexpr auto operator()(_Tp&& __t) const + noexcept(noexcept(ranges::data(static_cast<const remove_reference_t<_Tp>&>(__t)))) + -> decltype( ranges::data(static_cast<const remove_reference_t<_Tp>&>(__t))) + { return ranges::data(static_cast<const remove_reference_t<_Tp>&>(__t)); } + + template <class _Tp> + requires is_rvalue_reference_v<_Tp&&> + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI + constexpr auto operator()(_Tp&& __t) const + noexcept(noexcept(ranges::data(static_cast<const _Tp&&>(__t)))) + -> decltype( ranges::data(static_cast<const _Tp&&>(__t))) + { return ranges::data(static_cast<const _Tp&&>(__t)); } + }; +} + +inline namespace __cpo { + inline constexpr auto cdata = __cdata::__fn{}; +} // namespace __cpo +} // namespace ranges + #endif // !defined(_LIBCPP_HAS_NO_RANGES) _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__ranges/empty.h b/libcxx/include/__ranges/empty.h index e8a8aabf4aed..8da0b120f182 100644 --- a/libcxx/include/__ranges/empty.h +++ b/libcxx/include/__ranges/empty.h @@ -9,6 +9,7 @@ #ifndef _LIBCPP___RANGES_EMPTY_H #define _LIBCPP___RANGES_EMPTY_H +#include <__concepts/class_or_enum.h> #include <__config> #include <__iterator/concepts.h> #include <__ranges/access.h> @@ -28,9 +29,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { namespace __empty { template <class _Tp> - concept __member_empty = requires(_Tp&& __t) { - bool(__t.empty()); - }; + concept __member_empty = + __workaround_52970<_Tp> && + requires(_Tp&& __t) { + bool(__t.empty()); + }; template<class _Tp> concept __can_invoke_size = diff --git a/libcxx/include/__ranges/empty_view.h b/libcxx/include/__ranges/empty_view.h index 4a98a6f324e7..f744dcbe92f4 100644 --- a/libcxx/include/__ranges/empty_view.h +++ b/libcxx/include/__ranges/empty_view.h @@ -10,6 +10,7 @@ #define _LIBCPP___RANGES_EMPTY_VIEW_H #include <__config> +#include <__ranges/enable_borrowed_range.h> #include <__ranges/view_interface.h> #include <type_traits> @@ -32,6 +33,9 @@ namespace ranges { _LIBCPP_HIDE_FROM_ABI static constexpr size_t size() noexcept { return 0; } _LIBCPP_HIDE_FROM_ABI static constexpr bool empty() noexcept { return true; } }; + + template<class _Tp> + inline constexpr bool enable_borrowed_range<empty_view<_Tp>> = true; } // namespace ranges #endif // !defined(_LIBCPP_HAS_NO_RANGES) diff --git a/libcxx/include/__ranges/enable_view.h b/libcxx/include/__ranges/enable_view.h index a09de11da81e..e1daec046fc0 100644 --- a/libcxx/include/__ranges/enable_view.h +++ b/libcxx/include/__ranges/enable_view.h @@ -12,6 +12,7 @@ #include <__config> #include <concepts> +#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header @@ -25,8 +26,17 @@ namespace ranges { struct view_base { }; +template<class _Derived> + requires is_class_v<_Derived> && same_as<_Derived, remove_cv_t<_Derived>> +class view_interface; + +template<class _Op, class _Yp> + requires is_convertible_v<_Op*, view_interface<_Yp>*> +void __is_derived_from_view_interface(const _Op*, const view_interface<_Yp>*); + template <class _Tp> -inline constexpr bool enable_view = derived_from<_Tp, view_base>; +inline constexpr bool enable_view = derived_from<_Tp, view_base> || + requires { ranges::__is_derived_from_view_interface((_Tp*)nullptr, (_Tp*)nullptr); }; } // end namespace ranges diff --git a/libcxx/include/__ranges/owning_view.h b/libcxx/include/__ranges/owning_view.h new file mode 100644 index 000000000000..29182d2d8e46 --- /dev/null +++ b/libcxx/include/__ranges/owning_view.h @@ -0,0 +1,81 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +#ifndef _LIBCPP___RANGES_OWNING_VIEW_H +#define _LIBCPP___RANGES_OWNING_VIEW_H + +#include <__concepts/constructible.h> +#include <__concepts/movable.h> +#include <__config> +#include <__ranges/access.h> +#include <__ranges/concepts.h> +#include <__ranges/data.h> +#include <__ranges/empty.h> +#include <__ranges/enable_borrowed_range.h> +#include <__ranges/size.h> +#include <__ranges/view_interface.h> +#include <__utility/move.h> +#include <type_traits> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if !defined(_LIBCPP_HAS_NO_RANGES) + +namespace ranges { + template<range _Rp> + requires movable<_Rp> && (!__is_std_initializer_list<remove_cvref_t<_Rp>>) + class owning_view : public view_interface<owning_view<_Rp>> { + _Rp __r_ = _Rp(); + +public: + owning_view() requires default_initializable<_Rp> = default; + _LIBCPP_HIDE_FROM_ABI constexpr owning_view(_Rp&& __r) : __r_(_VSTD::move(__r)) {} + + owning_view(owning_view&&) = default; + owning_view& operator=(owning_view&&) = default; + + _LIBCPP_HIDE_FROM_ABI constexpr _Rp& base() & noexcept { return __r_; } + _LIBCPP_HIDE_FROM_ABI constexpr const _Rp& base() const& noexcept { return __r_; } + _LIBCPP_HIDE_FROM_ABI constexpr _Rp&& base() && noexcept { return _VSTD::move(__r_); } + _LIBCPP_HIDE_FROM_ABI constexpr const _Rp&& base() const&& noexcept { return _VSTD::move(__r_); } + + _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Rp> begin() { return ranges::begin(__r_); } + _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Rp> end() { return ranges::end(__r_); } + _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const requires range<const _Rp> { return ranges::begin(__r_); } + _LIBCPP_HIDE_FROM_ABI constexpr auto end() const requires range<const _Rp> { return ranges::end(__r_); } + + _LIBCPP_HIDE_FROM_ABI constexpr bool empty() requires requires { ranges::empty(__r_); } + { return ranges::empty(__r_); } + _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const requires requires { ranges::empty(__r_); } + { return ranges::empty(__r_); } + + _LIBCPP_HIDE_FROM_ABI constexpr auto size() requires sized_range<_Rp> + { return ranges::size(__r_); } + _LIBCPP_HIDE_FROM_ABI constexpr auto size() const requires sized_range<const _Rp> + { return ranges::size(__r_); } + + _LIBCPP_HIDE_FROM_ABI constexpr auto data() requires contiguous_range<_Rp> + { return ranges::data(__r_); } + _LIBCPP_HIDE_FROM_ABI constexpr auto data() const requires contiguous_range<const _Rp> + { return ranges::data(__r_); } + }; + + template<class _Tp> + inline constexpr bool enable_borrowed_range<owning_view<_Tp>> = enable_borrowed_range<_Tp>; + +} // namespace ranges + +#endif // !defined(_LIBCPP_HAS_NO_RANGES) + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___RANGES_OWNING_VIEW_H diff --git a/libcxx/include/__ranges/ref_view.h b/libcxx/include/__ranges/ref_view.h index 7567ac48f255..283fa2599bff 100644 --- a/libcxx/include/__ranges/ref_view.h +++ b/libcxx/include/__ranges/ref_view.h @@ -18,6 +18,7 @@ #include <__ranges/concepts.h> #include <__ranges/data.h> #include <__ranges/empty.h> +#include <__ranges/enable_borrowed_range.h> #include <__ranges/size.h> #include <__ranges/view_interface.h> #include <__utility/forward.h> @@ -74,6 +75,8 @@ public: template<class _Range> ref_view(_Range&) -> ref_view<_Range>; + template<class _Tp> + inline constexpr bool enable_borrowed_range<ref_view<_Tp>> = true; } // namespace ranges #endif // !defined(_LIBCPP_HAS_NO_RANGES) diff --git a/libcxx/include/__ranges/single_view.h b/libcxx/include/__ranges/single_view.h index 412fa9b64643..931ce78da7b9 100644 --- a/libcxx/include/__ranges/single_view.h +++ b/libcxx/include/__ranges/single_view.h @@ -10,8 +10,8 @@ #define _LIBCPP___RANGES_SINGLE_VIEW_H #include <__config> -#include <__ranges/view_interface.h> #include <__ranges/copyable_box.h> +#include <__ranges/view_interface.h> #include <__utility/forward.h> #include <__utility/in_place.h> #include <__utility/move.h> diff --git a/libcxx/include/__ranges/size.h b/libcxx/include/__ranges/size.h index fc6641cf4887..f3de5a8b8410 100644 --- a/libcxx/include/__ranges/size.h +++ b/libcxx/include/__ranges/size.h @@ -9,6 +9,7 @@ #ifndef _LIBCPP___RANGES_SIZE_H #define _LIBCPP___RANGES_SIZE_H +#include <__concepts/class_or_enum.h> #include <__config> #include <__iterator/concepts.h> #include <__iterator/iterator_traits.h> @@ -41,9 +42,12 @@ namespace __size { concept __size_enabled = !disable_sized_range<remove_cvref_t<_Tp>>; template <class _Tp> - concept __member_size = __size_enabled<_Tp> && requires(_Tp&& __t) { - { _LIBCPP_AUTO_CAST(__t.size()) } -> __integer_like; - }; + concept __member_size = + __size_enabled<_Tp> && + __workaround_52970<_Tp> && + requires(_Tp&& __t) { + { _LIBCPP_AUTO_CAST(__t.size()) } -> __integer_like; + }; template <class _Tp> concept __unqualified_size = diff --git a/libcxx/include/__ranges/subrange.h b/libcxx/include/__ranges/subrange.h index 8e984f2bf06c..14716d1fb0ff 100644 --- a/libcxx/include/__ranges/subrange.h +++ b/libcxx/include/__ranges/subrange.h @@ -40,12 +40,14 @@ _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { template<class _From, class _To> + concept __uses_nonqualification_pointer_conversion = + is_pointer_v<_From> && is_pointer_v<_To> && + !convertible_to<remove_pointer_t<_From>(*)[], remove_pointer_t<_To>(*)[]>; + + template<class _From, class _To> concept __convertible_to_non_slicing = convertible_to<_From, _To> && - // If they're both pointers, they must have the same element type. - !(is_pointer_v<decay_t<_From>> && - is_pointer_v<decay_t<_To>> && - __different_from<remove_pointer_t<decay_t<_From>>, remove_pointer_t<decay_t<_To>>>); + !__uses_nonqualification_pointer_conversion<decay_t<_From>, decay_t<_To>>; template<class _Tp> concept __pair_like = diff --git a/libcxx/include/__ranges/transform_view.h b/libcxx/include/__ranges/transform_view.h index 0f53fbaa7e68..1506e8b2a7fe 100644 --- a/libcxx/include/__ranges/transform_view.h +++ b/libcxx/include/__ranges/transform_view.h @@ -195,9 +195,7 @@ public: : __parent_(__i.__parent_), __current_(_VSTD::move(__i.__current_)) {} _LIBCPP_HIDE_FROM_ABI - constexpr iterator_t<_Base> base() const& - requires copyable<iterator_t<_Base>> - { + constexpr const iterator_t<_Base>& base() const& noexcept { return __current_; } diff --git a/libcxx/include/__ranges/view_interface.h b/libcxx/include/__ranges/view_interface.h index 8a1f5d8c9251..c5215cbcb8e3 100644 --- a/libcxx/include/__ranges/view_interface.h +++ b/libcxx/include/__ranges/view_interface.h @@ -18,7 +18,6 @@ #include <__ranges/access.h> #include <__ranges/concepts.h> #include <__ranges/empty.h> -#include <__ranges/enable_view.h> #include <concepts> #include <type_traits> @@ -40,7 +39,7 @@ void __implicitly_convert_to(type_identity_t<_Tp>) noexcept; template<class _Derived> requires is_class_v<_Derived> && same_as<_Derived, remove_cv_t<_Derived>> -class view_interface : public view_base { +class view_interface { _LIBCPP_HIDE_FROM_ABI constexpr _Derived& __derived() noexcept { static_assert(sizeof(_Derived) && derived_from<_Derived, view_interface> && view<_Derived>); |