From 836bd4ecf255b70ab4fcd5c24833e9a309eace38 Mon Sep 17 00:00:00 2001 From: Nikolas Klauser Date: Sun, 18 May 2025 22:28:31 +0200 Subject: [PATCH] [libc++] Remove _LIBCPP_HIDE_FROM_ABI from and its subheaders --- libcxx/include/__ranges/access.h | 29 +++--- libcxx/include/__ranges/all.h | 8 +- libcxx/include/__ranges/as_rvalue_view.h | 24 ++--- libcxx/include/__ranges/chunk_by_view.h | 43 ++++---- libcxx/include/__ranges/common_view.h | 30 +++--- libcxx/include/__ranges/counted.h | 11 ++- libcxx/include/__ranges/dangling.h | 2 +- libcxx/include/__ranges/data.h | 12 +-- libcxx/include/__ranges/drop_view.h | 59 ++++++----- libcxx/include/__ranges/drop_while_view.h | 18 ++-- libcxx/include/__ranges/elements_view.h | 92 ++++++++--------- libcxx/include/__ranges/empty.h | 6 +- libcxx/include/__ranges/empty_view.h | 10 +- libcxx/include/__ranges/filter_view.h | 54 +++++----- libcxx/include/__ranges/iota_view.h | 86 ++++++++-------- libcxx/include/__ranges/istream_view.h | 32 +++--- libcxx/include/__ranges/join_view.h | 77 +++++++-------- libcxx/include/__ranges/lazy_split_view.h | 97 +++++++++--------- libcxx/include/__ranges/movable_box.h | 61 ++++++------ .../include/__ranges/non_propagating_cache.h | 27 +++-- libcxx/include/__ranges/owning_view.h | 36 +++---- libcxx/include/__ranges/range_adaptor.h | 6 +- libcxx/include/__ranges/rbegin.h | 12 +-- libcxx/include/__ranges/ref_view.h | 15 ++- libcxx/include/__ranges/rend.h | 16 ++- libcxx/include/__ranges/repeat_view.h | 52 +++++----- libcxx/include/__ranges/reverse_view.h | 35 ++++--- libcxx/include/__ranges/single_view.h | 27 +++-- libcxx/include/__ranges/size.h | 10 +- libcxx/include/__ranges/split_view.h | 45 ++++----- libcxx/include/__ranges/subrange.h | 49 +++++----- libcxx/include/__ranges/take_view.h | 49 +++++----- libcxx/include/__ranges/take_while_view.h | 35 ++++--- libcxx/include/__ranges/to.h | 10 +- libcxx/include/__ranges/transform_view.h | 92 +++++++++-------- libcxx/include/__ranges/view_interface.h | 32 +++--- libcxx/include/__ranges/zip_view.h | 98 +++++++++---------- 37 files changed, 671 insertions(+), 726 deletions(-) diff --git a/libcxx/include/__ranges/access.h b/libcxx/include/__ranges/access.h index bbacef3eae6be..ec8245acbcffc 100644 --- a/libcxx/include/__ranges/access.h +++ b/libcxx/include/__ranges/access.h @@ -55,14 +55,14 @@ concept __unqualified_begin = struct __fn { template - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp (&__t)[]) const noexcept + [[nodiscard]] constexpr auto operator()(_Tp (&__t)[]) const noexcept requires(sizeof(_Tp) >= 0) // Disallow incomplete element types. { return __t + 0; } template - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp (&__t)[_Np]) const noexcept + [[nodiscard]] constexpr auto operator()(_Tp (&__t)[_Np]) const noexcept requires(sizeof(_Tp) >= 0) // Disallow incomplete element types. { return __t + 0; @@ -70,15 +70,13 @@ struct __fn { template requires __member_begin<_Tp> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const - noexcept(noexcept(_LIBCPP_AUTO_CAST(__t.begin()))) { + [[nodiscard]] constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(_LIBCPP_AUTO_CAST(__t.begin()))) { return _LIBCPP_AUTO_CAST(__t.begin()); } template requires __unqualified_begin<_Tp> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const - noexcept(noexcept(_LIBCPP_AUTO_CAST(begin(__t)))) { + [[nodiscard]] constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(_LIBCPP_AUTO_CAST(begin(__t)))) { return _LIBCPP_AUTO_CAST(begin(__t)); } @@ -119,7 +117,7 @@ concept __unqualified_end = struct __fn { template - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp (&__t)[_Np]) const noexcept + [[nodiscard]] constexpr auto operator()(_Tp (&__t)[_Np]) const noexcept requires(sizeof(_Tp) >= 0) // Disallow incomplete element types. { return __t + _Np; @@ -127,15 +125,13 @@ struct __fn { template requires __member_end<_Tp> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const - noexcept(noexcept(_LIBCPP_AUTO_CAST(__t.end()))) { + [[nodiscard]] constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(_LIBCPP_AUTO_CAST(__t.end()))) { return _LIBCPP_AUTO_CAST(__t.end()); } template requires __unqualified_end<_Tp> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const - noexcept(noexcept(_LIBCPP_AUTO_CAST(end(__t)))) { + [[nodiscard]] constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(_LIBCPP_AUTO_CAST(end(__t)))) { return _LIBCPP_AUTO_CAST(end(__t)); } @@ -155,7 +151,7 @@ namespace __cbegin { struct __fn { template requires is_lvalue_reference_v<_Tp&&> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const + [[nodiscard]] constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(ranges::begin(static_cast&>(__t)))) -> decltype(ranges::begin(static_cast&>(__t))) { return ranges::begin(static_cast&>(__t)); @@ -163,7 +159,7 @@ struct __fn { template requires is_rvalue_reference_v<_Tp&&> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const + [[nodiscard]] constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(ranges::begin(static_cast(__t)))) -> decltype(ranges::begin(static_cast(__t))) { return ranges::begin(static_cast(__t)); @@ -183,7 +179,7 @@ namespace __cend { struct __fn { template requires is_lvalue_reference_v<_Tp&&> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const + [[nodiscard]] constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(ranges::end(static_cast&>(__t)))) -> decltype(ranges::end(static_cast&>(__t))) { return ranges::end(static_cast&>(__t)); @@ -191,8 +187,9 @@ struct __fn { template requires is_rvalue_reference_v<_Tp&&> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const noexcept( - noexcept(ranges::end(static_cast(__t)))) -> decltype(ranges::end(static_cast(__t))) { + [[nodiscard]] constexpr auto operator()(_Tp&& __t) const + noexcept(noexcept(ranges::end(static_cast(__t)))) + -> decltype(ranges::end(static_cast(__t))) { return ranges::end(static_cast(__t)); } }; diff --git a/libcxx/include/__ranges/all.h b/libcxx/include/__ranges/all.h index 023cee6caa9a2..af990db60c6bc 100644 --- a/libcxx/include/__ranges/all.h +++ b/libcxx/include/__ranges/all.h @@ -39,14 +39,14 @@ namespace __all { struct __fn : __range_adaptor_closure<__fn> { template requires ranges::view> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const noexcept( - noexcept(_LIBCPP_AUTO_CAST(std::forward<_Tp>(__t)))) -> decltype(_LIBCPP_AUTO_CAST(std::forward<_Tp>(__t))) { + [[nodiscard]] constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(_LIBCPP_AUTO_CAST(std::forward<_Tp>(__t)))) + -> decltype(_LIBCPP_AUTO_CAST(std::forward<_Tp>(__t))) { return _LIBCPP_AUTO_CAST(std::forward<_Tp>(__t)); } template requires(!ranges::view>) && requires(_Tp&& __t) { ranges::ref_view{std::forward<_Tp>(__t)}; } - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const + [[nodiscard]] constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(ranges::ref_view{std::forward<_Tp>(__t)})) { return ranges::ref_view{std::forward<_Tp>(__t)}; } @@ -55,7 +55,7 @@ struct __fn : __range_adaptor_closure<__fn> { requires( !ranges::view> && !requires(_Tp&& __t) { ranges::ref_view{std::forward<_Tp>(__t)}; } && requires(_Tp&& __t) { ranges::owning_view{std::forward<_Tp>(__t)}; }) - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const + [[nodiscard]] constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(ranges::owning_view{std::forward<_Tp>(__t)})) { return ranges::owning_view{std::forward<_Tp>(__t)}; } diff --git a/libcxx/include/__ranges/as_rvalue_view.h b/libcxx/include/__ranges/as_rvalue_view.h index 5849a6c368396..5849563063d2d 100644 --- a/libcxx/include/__ranges/as_rvalue_view.h +++ b/libcxx/include/__ranges/as_rvalue_view.h @@ -42,33 +42,33 @@ class as_rvalue_view : public view_interface> { _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View(); public: - _LIBCPP_HIDE_FROM_ABI as_rvalue_view() + as_rvalue_view() requires default_initializable<_View> = default; - _LIBCPP_HIDE_FROM_ABI constexpr explicit as_rvalue_view(_View __base) : __base_(std::move(__base)) {} + constexpr explicit as_rvalue_view(_View __base) : __base_(std::move(__base)) {} - _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& + constexpr _View base() const& requires copy_constructible<_View> { return __base_; } - _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); } + constexpr _View base() && { return std::move(__base_); } - _LIBCPP_HIDE_FROM_ABI constexpr auto begin() + constexpr auto begin() requires(!__simple_view<_View>) { return move_iterator(ranges::begin(__base_)); } - _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const + constexpr auto begin() const requires range { return move_iterator(ranges::begin(__base_)); } - _LIBCPP_HIDE_FROM_ABI constexpr auto end() + constexpr auto end() requires(!__simple_view<_View>) { if constexpr (common_range<_View>) { @@ -78,7 +78,7 @@ class as_rvalue_view : public view_interface> { } } - _LIBCPP_HIDE_FROM_ABI constexpr auto end() const + constexpr auto end() const requires range { if constexpr (common_range) { @@ -88,13 +88,13 @@ class as_rvalue_view : public view_interface> { } } - _LIBCPP_HIDE_FROM_ABI constexpr auto size() + constexpr auto size() requires sized_range<_View> { return ranges::size(__base_); } - _LIBCPP_HIDE_FROM_ABI constexpr auto size() const + constexpr auto size() const requires sized_range { return ranges::size(__base_); @@ -111,7 +111,7 @@ namespace views { namespace __as_rvalue { struct __fn : __range_adaptor_closure<__fn> { template - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto + [[nodiscard]] static constexpr auto operator()(_Range&& __range) noexcept(noexcept(as_rvalue_view(std::forward<_Range>(__range)))) -> decltype(/*--------------------------*/ as_rvalue_view(std::forward<_Range>(__range))) { return /*---------------------------------*/ as_rvalue_view(std::forward<_Range>(__range)); @@ -119,7 +119,7 @@ struct __fn : __range_adaptor_closure<__fn> { template requires same_as, range_reference_t<_Range>> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto + [[nodiscard]] static constexpr auto operator()(_Range&& __range) noexcept(noexcept(views::all(std::forward<_Range>(__range)))) -> decltype(/*--------------------------*/ views::all(std::forward<_Range>(__range))) { return /*---------------------------------*/ views::all(std::forward<_Range>(__range)); diff --git a/libcxx/include/__ranges/chunk_by_view.h b/libcxx/include/__ranges/chunk_by_view.h index 71fee3a4f2d1e..081090615e92d 100644 --- a/libcxx/include/__ranges/chunk_by_view.h +++ b/libcxx/include/__ranges/chunk_by_view.h @@ -64,7 +64,7 @@ class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS chunk_by_view : public view_interface class __iterator; - _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_View> __find_next(iterator_t<_View> __current) { + constexpr iterator_t<_View> __find_next(iterator_t<_View> __current) { // Note: this duplicates a check in `optional` but provides a better error message. _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( __pred_.__has_value(), "Trying to call __find_next() on a chunk_by_view that does not have a valid predicate."); @@ -75,7 +75,7 @@ class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS chunk_by_view : public view_interface ranges::adjacent_find(__current, ranges::end(__base_), __reversed_pred), 1, ranges::end(__base_)); } - _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_View> __find_prev(iterator_t<_View> __current) + constexpr iterator_t<_View> __find_prev(iterator_t<_View> __current) requires bidirectional_range<_View> { // Attempting to decrement a begin iterator is a no-op (`__find_prev` would return the same argument given to it). @@ -93,24 +93,24 @@ class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS chunk_by_view : public view_interface } public: - _LIBCPP_HIDE_FROM_ABI chunk_by_view() + chunk_by_view() requires default_initializable<_View> && default_initializable<_Pred> = default; - _LIBCPP_HIDE_FROM_ABI constexpr explicit chunk_by_view(_View __base, _Pred __pred) + constexpr explicit chunk_by_view(_View __base, _Pred __pred) : __base_(std::move(__base)), __pred_(in_place, std::move(__pred)) {} - _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& + constexpr _View base() const& requires copy_constructible<_View> { return __base_; } - _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); } + constexpr _View base() && { return std::move(__base_); } - _LIBCPP_HIDE_FROM_ABI constexpr const _Pred& pred() const { return *__pred_; } + constexpr const _Pred& pred() const { return *__pred_; } - _LIBCPP_HIDE_FROM_ABI constexpr __iterator begin() { + constexpr __iterator begin() { // Note: this duplicates a check in `optional` but provides a better error message. _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( __pred_.__has_value(), "Trying to call begin() on a chunk_by_view that does not have a valid predicate."); @@ -122,7 +122,7 @@ class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS chunk_by_view : public view_interface return {*this, std::move(__first), *__cached_begin_}; } - _LIBCPP_HIDE_FROM_ABI constexpr auto end() { + constexpr auto end() { if constexpr (common_range<_View>) { return __iterator{*this, ranges::end(__base_), ranges::end(__base_)}; } else { @@ -143,8 +143,7 @@ class chunk_by_view<_View, _Pred>::__iterator { _LIBCPP_NO_UNIQUE_ADDRESS iterator_t<_View> __current_ = iterator_t<_View>(); _LIBCPP_NO_UNIQUE_ADDRESS iterator_t<_View> __next_ = iterator_t<_View>(); - _LIBCPP_HIDE_FROM_ABI constexpr __iterator( - chunk_by_view& __parent, iterator_t<_View> __current, iterator_t<_View> __next) + constexpr __iterator(chunk_by_view& __parent, iterator_t<_View> __current, iterator_t<_View> __next) : __parent_(std::addressof(__parent)), __current_(__current), __next_(__next) {} public: @@ -153,16 +152,16 @@ class chunk_by_view<_View, _Pred>::__iterator { using iterator_category = input_iterator_tag; using iterator_concept = conditional_t, bidirectional_iterator_tag, forward_iterator_tag>; - _LIBCPP_HIDE_FROM_ABI __iterator() = default; + __iterator() = default; - _LIBCPP_HIDE_FROM_ABI constexpr value_type operator*() const { + constexpr value_type operator*() const { // If the iterator is at end, this would return an empty range which can be checked by the calling code and doesn't // necessarily lead to a bad access. _LIBCPP_ASSERT_PEDANTIC(__current_ != __next_, "Trying to dereference past-the-end chunk_by_view iterator."); return {__current_, __next_}; } - _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() { + constexpr __iterator& operator++() { // Attempting to increment an end iterator is a no-op (`__find_next` would return the same argument given to it). _LIBCPP_ASSERT_PEDANTIC(__current_ != __next_, "Trying to increment past end chunk_by_view iterator."); __current_ = __next_; @@ -170,13 +169,13 @@ class chunk_by_view<_View, _Pred>::__iterator { return *this; } - _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int) { + constexpr __iterator operator++(int) { auto __tmp = *this; ++*this; return __tmp; } - _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator--() + constexpr __iterator& operator--() requires bidirectional_range<_View> { __next_ = __current_; @@ -184,7 +183,7 @@ class chunk_by_view<_View, _Pred>::__iterator { return *this; } - _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator--(int) + constexpr __iterator operator--(int) requires bidirectional_range<_View> { auto __tmp = *this; @@ -192,20 +191,18 @@ class chunk_by_view<_View, _Pred>::__iterator { return __tmp; } - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __iterator& __y) { + friend constexpr bool operator==(const __iterator& __x, const __iterator& __y) { return __x.__current_ == __y.__current_; } - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, default_sentinel_t) { - return __x.__current_ == __x.__next_; - } + friend constexpr bool operator==(const __iterator& __x, default_sentinel_t) { return __x.__current_ == __x.__next_; } }; namespace views { namespace __chunk_by { struct __fn { template - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Pred&& __pred) const + [[nodiscard]] constexpr auto operator()(_Range&& __range, _Pred&& __pred) const noexcept(noexcept(/**/ chunk_by_view(std::forward<_Range>(__range), std::forward<_Pred>(__pred)))) -> decltype(/*--*/ chunk_by_view(std::forward<_Range>(__range), std::forward<_Pred>(__pred))) { return /*-------------*/ chunk_by_view(std::forward<_Range>(__range), std::forward<_Pred>(__pred)); @@ -213,7 +210,7 @@ struct __fn { template requires constructible_from, _Pred> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Pred&& __pred) const + [[nodiscard]] constexpr auto operator()(_Pred&& __pred) const noexcept(is_nothrow_constructible_v, _Pred>) { return __pipeable(std::__bind_back(*this, std::forward<_Pred>(__pred))); } diff --git a/libcxx/include/__ranges/common_view.h b/libcxx/include/__ranges/common_view.h index 133236dd1d78a..208bd3ebe32fa 100644 --- a/libcxx/include/__ranges/common_view.h +++ b/libcxx/include/__ranges/common_view.h @@ -44,28 +44,28 @@ class common_view : public view_interface> { _View __base_ = _View(); public: - _LIBCPP_HIDE_FROM_ABI common_view() + common_view() requires default_initializable<_View> = default; - _LIBCPP_HIDE_FROM_ABI constexpr explicit common_view(_View __v) : __base_(std::move(__v)) {} + constexpr explicit common_view(_View __v) : __base_(std::move(__v)) {} - _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& + constexpr _View base() const& requires copy_constructible<_View> { return __base_; } - _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); } + constexpr _View base() && { return std::move(__base_); } - _LIBCPP_HIDE_FROM_ABI constexpr auto begin() { + constexpr auto begin() { if constexpr (random_access_range<_View> && sized_range<_View>) return ranges::begin(__base_); else return common_iterator, sentinel_t<_View>>(ranges::begin(__base_)); } - _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const + constexpr auto begin() const requires range { if constexpr (random_access_range && sized_range) @@ -74,14 +74,14 @@ class common_view : public view_interface> { return common_iterator, sentinel_t>(ranges::begin(__base_)); } - _LIBCPP_HIDE_FROM_ABI constexpr auto end() { + constexpr auto end() { if constexpr (random_access_range<_View> && sized_range<_View>) return ranges::begin(__base_) + ranges::size(__base_); else return common_iterator, sentinel_t<_View>>(ranges::end(__base_)); } - _LIBCPP_HIDE_FROM_ABI constexpr auto end() const + constexpr auto end() const requires range { if constexpr (random_access_range && sized_range) @@ -90,13 +90,13 @@ class common_view : public view_interface> { return common_iterator, sentinel_t>(ranges::end(__base_)); } - _LIBCPP_HIDE_FROM_ABI constexpr auto size() + constexpr auto size() requires sized_range<_View> { return ranges::size(__base_); } - _LIBCPP_HIDE_FROM_ABI constexpr auto size() const + constexpr auto size() const requires sized_range { return ranges::size(__base_); @@ -114,14 +114,16 @@ namespace __common { struct __fn : __range_adaptor_closure<__fn> { template requires common_range<_Range> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const noexcept( - noexcept(views::all(std::forward<_Range>(__range)))) -> decltype(views::all(std::forward<_Range>(__range))) { + [[nodiscard]] constexpr auto operator()(_Range&& __range) const + noexcept(noexcept(views::all(std::forward<_Range>(__range)))) + -> decltype(views::all(std::forward<_Range>(__range))) { return views::all(std::forward<_Range>(__range)); } template - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const noexcept(noexcept(common_view{ - std::forward<_Range>(__range)})) -> decltype(common_view{std::forward<_Range>(__range)}) { + [[nodiscard]] constexpr auto operator()(_Range&& __range) const + noexcept(noexcept(common_view{std::forward<_Range>(__range)})) + -> decltype(common_view{std::forward<_Range>(__range)}) { return common_view{std::forward<_Range>(__range)}; } }; diff --git a/libcxx/include/__ranges/counted.h b/libcxx/include/__ranges/counted.h index 65bf1a371ec78..c7e052903af15 100644 --- a/libcxx/include/__ranges/counted.h +++ b/libcxx/include/__ranges/counted.h @@ -42,7 +42,7 @@ namespace __counted { struct __fn { template - _LIBCPP_HIDE_FROM_ABI static constexpr auto + static constexpr auto __go(_It __it, iter_difference_t<_It> __count) noexcept(noexcept(span(std::to_address(__it), static_cast(__count)))) // Deliberately omit return-type SFINAE, because to_address is not SFINAE-friendly @@ -51,13 +51,14 @@ struct __fn { } template - _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_It __it, iter_difference_t<_It> __count) noexcept( - noexcept(subrange(__it, __it + __count))) -> decltype(subrange(__it, __it + __count)) { + static constexpr auto + __go(_It __it, iter_difference_t<_It> __count) noexcept(noexcept(subrange(__it, __it + __count))) + -> decltype(subrange(__it, __it + __count)) { return subrange(__it, __it + __count); } template - _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_It __it, iter_difference_t<_It> __count) noexcept( + static constexpr auto __go(_It __it, iter_difference_t<_It> __count) noexcept( noexcept(subrange(counted_iterator(std::move(__it), __count), default_sentinel))) -> decltype(subrange(counted_iterator(std::move(__it), __count), default_sentinel)) { return subrange(counted_iterator(std::move(__it), __count), default_sentinel); @@ -65,7 +66,7 @@ struct __fn { template > _Diff> requires input_or_output_iterator> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_It&& __it, _Diff&& __count) const + [[nodiscard]] constexpr auto operator()(_It&& __it, _Diff&& __count) const noexcept(noexcept(__go(std::forward<_It>(__it), std::forward<_Diff>(__count)))) -> decltype(__go(std::forward<_It>(__it), std::forward<_Diff>(__count))) { return __go(std::forward<_It>(__it), std::forward<_Diff>(__count)); diff --git a/libcxx/include/__ranges/dangling.h b/libcxx/include/__ranges/dangling.h index 613084d5fb9fc..fe496e75cb987 100644 --- a/libcxx/include/__ranges/dangling.h +++ b/libcxx/include/__ranges/dangling.h @@ -26,7 +26,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { struct dangling { dangling() = default; - _LIBCPP_HIDE_FROM_ABI constexpr dangling(auto&&...) noexcept {} + constexpr dangling(auto&&...) noexcept {} }; template diff --git a/libcxx/include/__ranges/data.h b/libcxx/include/__ranges/data.h index 50db3cffeeed8..13584ecfa1602 100644 --- a/libcxx/include/__ranges/data.h +++ b/libcxx/include/__ranges/data.h @@ -51,13 +51,12 @@ concept __ranges_begin_invocable = !__member_data<_Tp> && __can_borrow<_Tp> && r struct __fn { template <__member_data _Tp> - _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(__t.data())) { + constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(__t.data())) { return __t.data(); } template <__ranges_begin_invocable _Tp> - _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const - noexcept(noexcept(std::to_address(ranges::begin(__t)))) { + constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(std::to_address(ranges::begin(__t)))) { return std::to_address(ranges::begin(__t)); } }; @@ -75,7 +74,7 @@ namespace __cdata { struct __fn { template requires is_lvalue_reference_v<_Tp&&> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const + [[nodiscard]] constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(ranges::data(static_cast&>(__t)))) -> decltype(ranges::data(static_cast&>(__t))) { return ranges::data(static_cast&>(__t)); @@ -83,8 +82,9 @@ struct __fn { template requires is_rvalue_reference_v<_Tp&&> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const noexcept( - noexcept(ranges::data(static_cast(__t)))) -> decltype(ranges::data(static_cast(__t))) { + [[nodiscard]] constexpr auto operator()(_Tp&& __t) const + noexcept(noexcept(ranges::data(static_cast(__t)))) + -> decltype(ranges::data(static_cast(__t))) { return ranges::data(static_cast(__t)); } }; diff --git a/libcxx/include/__ranges/drop_view.h b/libcxx/include/__ranges/drop_view.h index 42ada9299a779..021f5a7e78e0b 100644 --- a/libcxx/include/__ranges/drop_view.h +++ b/libcxx/include/__ranges/drop_view.h @@ -70,24 +70,23 @@ class drop_view : public view_interface> { _View __base_ = _View(); public: - _LIBCPP_HIDE_FROM_ABI drop_view() + drop_view() requires default_initializable<_View> = default; - _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 - drop_view(_View __base, range_difference_t<_View> __count) + constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 drop_view(_View __base, range_difference_t<_View> __count) : __count_(__count), __base_(std::move(__base)) { _LIBCPP_ASSERT_UNCATEGORIZED(__count_ >= 0, "count must be greater than or equal to zero."); } - _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& + constexpr _View base() const& requires copy_constructible<_View> { return __base_; } - _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); } + constexpr _View base() && { return std::move(__base_); } - _LIBCPP_HIDE_FROM_ABI constexpr auto begin() + constexpr auto begin() requires(!(__simple_view<_View> && random_access_range && sized_range)) { if constexpr (random_access_range<_View> && sized_range<_View>) { @@ -104,38 +103,38 @@ class drop_view : public view_interface> { return __tmp; } - _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const + constexpr auto begin() const requires random_access_range && sized_range { const auto __dist = std::min(ranges::distance(__base_), __count_); return ranges::begin(__base_) + __dist; } - _LIBCPP_HIDE_FROM_ABI constexpr auto end() + constexpr auto end() requires(!__simple_view<_View>) { return ranges::end(__base_); } - _LIBCPP_HIDE_FROM_ABI constexpr auto end() const + constexpr auto end() const requires range { return ranges::end(__base_); } - _LIBCPP_HIDE_FROM_ABI static constexpr auto __size(auto& __self) { + static constexpr auto __size(auto& __self) { const auto __s = ranges::size(__self.__base_); const auto __c = static_cast(__self.__count_); return __s < __c ? 0 : __s - __c; } - _LIBCPP_HIDE_FROM_ABI constexpr auto size() + constexpr auto size() requires sized_range<_View> { return __size(*this); } - _LIBCPP_HIDE_FROM_ABI constexpr auto size() const + constexpr auto size() const requires sized_range { return __size(*this); @@ -210,7 +209,7 @@ struct __fn { // [range.drop.overview]: the `empty_view` case. template > _Np> requires __is_empty_view> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Np&&) const + [[nodiscard]] constexpr auto operator()(_Range&& __range, _Np&&) const noexcept(noexcept(_LIBCPP_AUTO_CAST(std::forward<_Range>(__range)))) -> decltype(_LIBCPP_AUTO_CAST(std::forward<_Range>(__range))) { return _LIBCPP_AUTO_CAST(std::forward<_Range>(__range)); @@ -223,7 +222,7 @@ struct __fn { class _Dist = range_difference_t<_Range>> requires(!__is_empty_view<_RawRange> && random_access_range<_RawRange> && sized_range<_RawRange> && __is_passthrough_specialization<_RawRange>) - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __rng, _Np&& __n) const + [[nodiscard]] constexpr auto operator()(_Range&& __rng, _Np&& __n) const noexcept(noexcept(__passthrough_type_t<_RawRange>( ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)), ranges::end(__rng)))) -> decltype(__passthrough_type_t<_RawRange>( @@ -241,11 +240,11 @@ struct __fn { class _Dist = range_difference_t<_Range>> requires(!__is_empty_view<_RawRange> && random_access_range<_RawRange> && sized_range<_RawRange> && __is_subrange_specialization_with_store_size<_RawRange>) - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __rng, _Np&& __n) const noexcept(noexcept( - _RawRange(ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)), - ranges::end(__rng), - std::__to_unsigned_like(ranges::distance(__rng) - - std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)))))) + [[nodiscard]] constexpr auto operator()(_Range&& __rng, _Np&& __n) const noexcept(noexcept(_RawRange( + ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)), + ranges::end(__rng), + std::__to_unsigned_like(ranges::distance(__rng) - + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)))))) -> decltype(_RawRange( // Note: deliberately not forwarding `__rng` to guard against double moves. ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)), @@ -266,7 +265,7 @@ struct __fn { class _RawRange = remove_cvref_t<_Range>, class _Dist = range_difference_t<_Range>> requires (__is_repeat_specialization<_RawRange> && sized_range<_RawRange>) - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Np&& __n) const + [[nodiscard]] constexpr auto operator()(_Range&& __range, _Np&& __n) const noexcept(noexcept(views::repeat(*__range.__value_, ranges::distance(__range) - std::min<_Dist>(ranges::distance(__range), std::forward<_Np>(__n))))) -> decltype( views::repeat(*__range.__value_, ranges::distance(__range) - std::min<_Dist>(ranges::distance(__range), std::forward<_Np>(__n)))) { return views::repeat(*__range.__value_, ranges::distance(__range) - std::min<_Dist>(ranges::distance(__range), std::forward<_Np>(__n))); } @@ -277,8 +276,7 @@ struct __fn { class _RawRange = remove_cvref_t<_Range>, class _Dist = range_difference_t<_Range>> requires (__is_repeat_specialization<_RawRange> && !sized_range<_RawRange>) - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI - constexpr auto operator()(_Range&& __range, _Np&&) const + [[nodiscard]] constexpr auto operator()(_Range&& __range, _Np&&) const noexcept(noexcept(_LIBCPP_AUTO_CAST(std::forward<_Range>(__range)))) -> decltype( _LIBCPP_AUTO_CAST(std::forward<_Range>(__range))) { return _LIBCPP_AUTO_CAST(std::forward<_Range>(__range)); } @@ -289,15 +287,15 @@ struct __fn { template > _Np, class _RawRange = remove_cvref_t<_Range>> // Note: without specifically excluding the other cases, GCC sees this overload as ambiguous with the other // overloads. - requires(!(__is_empty_view<_RawRange> || + requires( + !(__is_empty_view<_RawRange> || # if _LIBCPP_STD_VER >= 23 - __is_repeat_specialization<_RawRange> || + __is_repeat_specialization<_RawRange> || # endif - (__is_subrange_specialization_with_store_size<_RawRange> && sized_range<_RawRange> && - random_access_range<_RawRange>) || - (__is_passthrough_specialization<_RawRange> && sized_range<_RawRange> && - random_access_range<_RawRange>))) - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Np&& __n) const + (__is_subrange_specialization_with_store_size<_RawRange> && sized_range<_RawRange> && + random_access_range<_RawRange>) || + (__is_passthrough_specialization<_RawRange> && sized_range<_RawRange> && random_access_range<_RawRange>))) + [[nodiscard]] constexpr auto operator()(_Range&& __range, _Np&& __n) const noexcept(noexcept(drop_view(std::forward<_Range>(__range), std::forward<_Np>(__n)))) -> decltype(drop_view(std::forward<_Range>(__range), std::forward<_Np>(__n))) { return drop_view(std::forward<_Range>(__range), std::forward<_Np>(__n)); @@ -305,8 +303,7 @@ struct __fn { template requires constructible_from, _Np> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Np&& __n) const - noexcept(is_nothrow_constructible_v, _Np>) { + [[nodiscard]] constexpr auto operator()(_Np&& __n) const noexcept(is_nothrow_constructible_v, _Np>) { return __pipeable(std::__bind_back(*this, std::forward<_Np>(__n))); } }; diff --git a/libcxx/include/__ranges/drop_while_view.h b/libcxx/include/__ranges/drop_while_view.h index bc7f019393a80..d4fca80b1ca47 100644 --- a/libcxx/include/__ranges/drop_while_view.h +++ b/libcxx/include/__ranges/drop_while_view.h @@ -50,24 +50,24 @@ template requires input_range<_View> && is_object_v<_Pred> && indirect_unary_predicate> class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS drop_while_view : public view_interface> { public: - _LIBCPP_HIDE_FROM_ABI drop_while_view() + drop_while_view() requires default_initializable<_View> && default_initializable<_Pred> = default; - _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 drop_while_view(_View __base, _Pred __pred) + constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 drop_while_view(_View __base, _Pred __pred) : __base_(std::move(__base)), __pred_(std::in_place, std::move(__pred)) {} - _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& + constexpr _View base() const& requires copy_constructible<_View> { return __base_; } - _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); } + constexpr _View base() && { return std::move(__base_); } - _LIBCPP_HIDE_FROM_ABI constexpr const _Pred& pred() const { return *__pred_; } + constexpr const _Pred& pred() const { return *__pred_; } - _LIBCPP_HIDE_FROM_ABI constexpr auto begin() { + constexpr auto begin() { // Note: this duplicates a check in `optional` but provides a better error message. _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( __pred_.__has_value(), @@ -83,7 +83,7 @@ class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS drop_while_view : public view_interfa } } - _LIBCPP_HIDE_FROM_ABI constexpr auto end() { return ranges::end(__base_); } + constexpr auto end() { return ranges::end(__base_); } private: _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View(); @@ -105,7 +105,7 @@ namespace __drop_while { struct __fn { template - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Pred&& __pred) const + [[nodiscard]] constexpr auto operator()(_Range&& __range, _Pred&& __pred) const noexcept(noexcept(/**/ drop_while_view(std::forward<_Range>(__range), std::forward<_Pred>(__pred)))) -> decltype(/*--*/ drop_while_view(std::forward<_Range>(__range), std::forward<_Pred>(__pred))) { return /*-------------*/ drop_while_view(std::forward<_Range>(__range), std::forward<_Pred>(__pred)); @@ -113,7 +113,7 @@ struct __fn { template requires constructible_from, _Pred> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Pred&& __pred) const + [[nodiscard]] constexpr auto operator()(_Pred&& __pred) const noexcept(is_nothrow_constructible_v, _Pred>) { return __pipeable(std::__bind_back(*this, std::forward<_Pred>(__pred))); } diff --git a/libcxx/include/__ranges/elements_view.h b/libcxx/include/__ranges/elements_view.h index b1419f2a1dd91..88e4b96fbb946 100644 --- a/libcxx/include/__ranges/elements_view.h +++ b/libcxx/include/__ranges/elements_view.h @@ -71,63 +71,63 @@ class elements_view : public view_interface> { class __sentinel; public: - _LIBCPP_HIDE_FROM_ABI elements_view() + elements_view() requires default_initializable<_View> = default; - _LIBCPP_HIDE_FROM_ABI constexpr explicit elements_view(_View __base) : __base_(std::move(__base)) {} + constexpr explicit elements_view(_View __base) : __base_(std::move(__base)) {} - _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& + constexpr _View base() const& requires copy_constructible<_View> { return __base_; } - _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); } + constexpr _View base() && { return std::move(__base_); } - _LIBCPP_HIDE_FROM_ABI constexpr auto begin() + constexpr auto begin() requires(!__simple_view<_View>) { return __iterator(ranges::begin(__base_)); } - _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const + constexpr auto begin() const requires range { return __iterator(ranges::begin(__base_)); } - _LIBCPP_HIDE_FROM_ABI constexpr auto end() + constexpr auto end() requires(!__simple_view<_View> && !common_range<_View>) { return __sentinel{ranges::end(__base_)}; } - _LIBCPP_HIDE_FROM_ABI constexpr auto end() + constexpr auto end() requires(!__simple_view<_View> && common_range<_View>) { return __iterator{ranges::end(__base_)}; } - _LIBCPP_HIDE_FROM_ABI constexpr auto end() const + constexpr auto end() const requires range { return __sentinel{ranges::end(__base_)}; } - _LIBCPP_HIDE_FROM_ABI constexpr auto end() const + constexpr auto end() const requires common_range { return __iterator{ranges::end(__base_)}; } - _LIBCPP_HIDE_FROM_ABI constexpr auto size() + constexpr auto size() requires sized_range<_View> { return ranges::size(__base_); } - _LIBCPP_HIDE_FROM_ABI constexpr auto size() const + constexpr auto size() const requires sized_range { return ranges::size(__base_); @@ -175,7 +175,7 @@ class elements_view<_View, _Np>::__iterator iterator_t<_Base> __current_ = iterator_t<_Base>(); - _LIBCPP_HIDE_FROM_ABI static constexpr decltype(auto) __get_element(const iterator_t<_Base>& __i) { + static constexpr decltype(auto) __get_element(const iterator_t<_Base>& __i) { if constexpr (is_reference_v>) { return std::get<_Np>(*__i); } else { @@ -201,30 +201,30 @@ class elements_view<_View, _Np>::__iterator using value_type = remove_cvref_t>>; using difference_type = range_difference_t<_Base>; - _LIBCPP_HIDE_FROM_ABI __iterator() + __iterator() requires default_initializable> = default; - _LIBCPP_HIDE_FROM_ABI constexpr explicit __iterator(iterator_t<_Base> __current) : __current_(std::move(__current)) {} + constexpr explicit __iterator(iterator_t<_Base> __current) : __current_(std::move(__current)) {} - _LIBCPP_HIDE_FROM_ABI constexpr __iterator(__iterator __i) + constexpr __iterator(__iterator __i) requires _Const && convertible_to, iterator_t<_Base>> : __current_(std::move(__i.__current_)) {} - _LIBCPP_HIDE_FROM_ABI constexpr const iterator_t<_Base>& base() const& noexcept { return __current_; } + constexpr const iterator_t<_Base>& base() const& noexcept { return __current_; } - _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Base> base() && { return std::move(__current_); } + constexpr iterator_t<_Base> base() && { return std::move(__current_); } - _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const { return __get_element(__current_); } + constexpr decltype(auto) operator*() const { return __get_element(__current_); } - _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() { + constexpr __iterator& operator++() { ++__current_; return *this; } - _LIBCPP_HIDE_FROM_ABI constexpr void operator++(int) { ++__current_; } + constexpr void operator++(int) { ++__current_; } - _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int) + constexpr __iterator operator++(int) requires forward_range<_Base> { auto __temp = *this; @@ -232,14 +232,14 @@ class elements_view<_View, _Np>::__iterator return __temp; } - _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator--() + constexpr __iterator& operator--() requires bidirectional_range<_Base> { --__current_; return *this; } - _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator--(int) + constexpr __iterator operator--(int) requires bidirectional_range<_Base> { auto __temp = *this; @@ -247,81 +247,81 @@ class elements_view<_View, _Np>::__iterator return __temp; } - _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator+=(difference_type __n) + constexpr __iterator& operator+=(difference_type __n) requires random_access_range<_Base> { __current_ += __n; return *this; } - _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator-=(difference_type __n) + constexpr __iterator& operator-=(difference_type __n) requires random_access_range<_Base> { __current_ -= __n; return *this; } - _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](difference_type __n) const + constexpr decltype(auto) operator[](difference_type __n) const requires random_access_range<_Base> { return __get_element(__current_ + __n); } - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __iterator& __y) + friend constexpr bool operator==(const __iterator& __x, const __iterator& __y) requires equality_comparable> { return __x.__current_ == __y.__current_; } - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(const __iterator& __x, const __iterator& __y) + friend constexpr bool operator<(const __iterator& __x, const __iterator& __y) requires random_access_range<_Base> { return __x.__current_ < __y.__current_; } - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(const __iterator& __x, const __iterator& __y) + friend constexpr bool operator>(const __iterator& __x, const __iterator& __y) requires random_access_range<_Base> { return __y < __x; } - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(const __iterator& __x, const __iterator& __y) + friend constexpr bool operator<=(const __iterator& __x, const __iterator& __y) requires random_access_range<_Base> { return !(__y < __x); } - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(const __iterator& __x, const __iterator& __y) + friend constexpr bool operator>=(const __iterator& __x, const __iterator& __y) requires random_access_range<_Base> { return !(__x < __y); } - _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator<=>(const __iterator& __x, const __iterator& __y) + friend constexpr auto operator<=>(const __iterator& __x, const __iterator& __y) requires random_access_range<_Base> && three_way_comparable> { return __x.__current_ <=> __y.__current_; } - _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(const __iterator& __x, difference_type __y) + friend constexpr __iterator operator+(const __iterator& __x, difference_type __y) requires random_access_range<_Base> { return __iterator{__x} += __y; } - _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __x, const __iterator& __y) + friend constexpr __iterator operator+(difference_type __x, const __iterator& __y) requires random_access_range<_Base> { return __y + __x; } - _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(const __iterator& __x, difference_type __y) + friend constexpr __iterator operator-(const __iterator& __x, difference_type __y) requires random_access_range<_Base> { return __iterator{__x} -= __y; } - _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y) + friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y) requires sized_sentinel_for, iterator_t<_Base>> { return __x.__current_ - __y.__current_; @@ -342,37 +342,37 @@ class elements_view<_View, _Np>::__sentinel { friend class __sentinel; template - _LIBCPP_HIDE_FROM_ABI static constexpr decltype(auto) __get_current(const __iterator<_AnyConst>& __iter) { + static constexpr decltype(auto) __get_current(const __iterator<_AnyConst>& __iter) { return (__iter.__current_); } public: - _LIBCPP_HIDE_FROM_ABI __sentinel() = default; + __sentinel() = default; - _LIBCPP_HIDE_FROM_ABI constexpr explicit __sentinel(sentinel_t<_Base> __end) : __end_(std::move(__end)) {} + constexpr explicit __sentinel(sentinel_t<_Base> __end) : __end_(std::move(__end)) {} - _LIBCPP_HIDE_FROM_ABI constexpr __sentinel(__sentinel __other) + constexpr __sentinel(__sentinel __other) requires _Const && convertible_to, sentinel_t<_Base>> : __end_(std::move(__other.__end_)) {} - _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Base> base() const { return __end_; } + constexpr sentinel_t<_Base> base() const { return __end_; } template requires sentinel_for, iterator_t<__maybe_const<_OtherConst, _View>>> - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator<_OtherConst>& __x, const __sentinel& __y) { + friend constexpr bool operator==(const __iterator<_OtherConst>& __x, const __sentinel& __y) { return __get_current(__x) == __y.__end_; } template requires sized_sentinel_for, iterator_t<__maybe_const<_OtherConst, _View>>> - _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>> + friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>> operator-(const __iterator<_OtherConst>& __x, const __sentinel& __y) { return __get_current(__x) - __y.__end_; } template requires sized_sentinel_for, iterator_t<__maybe_const<_OtherConst, _View>>> - _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>> + friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>> operator-(const __sentinel& __x, const __iterator<_OtherConst>& __y) { return __x.__end_ - __get_current(__y); } @@ -392,7 +392,7 @@ namespace __elements { template struct __fn : __range_adaptor_closure<__fn<_Np>> { template - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const + [[nodiscard]] constexpr auto operator()(_Range&& __range) const /**/ noexcept(noexcept(elements_view, _Np>(std::forward<_Range>(__range)))) /*------*/ -> decltype(elements_view, _Np>(std::forward<_Range>(__range))) { /*-------------*/ return elements_view, _Np>(std::forward<_Range>(__range)); diff --git a/libcxx/include/__ranges/empty.h b/libcxx/include/__ranges/empty.h index 5c1004042aba5..4a5f1235992ec 100644 --- a/libcxx/include/__ranges/empty.h +++ b/libcxx/include/__ranges/empty.h @@ -42,17 +42,17 @@ concept __can_compare_begin_end = !__member_empty<_Tp> && !__can_invoke_size<_Tp struct __fn { template <__member_empty _Tp> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t) const noexcept(noexcept(bool(__t.empty()))) { + [[nodiscard]] constexpr bool operator()(_Tp&& __t) const noexcept(noexcept(bool(__t.empty()))) { return bool(__t.empty()); } template <__can_invoke_size _Tp> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t) const noexcept(noexcept(ranges::size(__t))) { + [[nodiscard]] constexpr bool operator()(_Tp&& __t) const noexcept(noexcept(ranges::size(__t))) { return ranges::size(__t) == 0; } template <__can_compare_begin_end _Tp> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t) const + [[nodiscard]] constexpr bool operator()(_Tp&& __t) const noexcept(noexcept(bool(ranges::begin(__t) == ranges::end(__t)))) { return ranges::begin(__t) == ranges::end(__t); } diff --git a/libcxx/include/__ranges/empty_view.h b/libcxx/include/__ranges/empty_view.h index fc08492110f53..0fad6de73ff50 100644 --- a/libcxx/include/__ranges/empty_view.h +++ b/libcxx/include/__ranges/empty_view.h @@ -29,11 +29,11 @@ template requires is_object_v<_Tp> class empty_view : public view_interface> { public: - _LIBCPP_HIDE_FROM_ABI static constexpr _Tp* begin() noexcept { return nullptr; } - _LIBCPP_HIDE_FROM_ABI static constexpr _Tp* end() noexcept { return nullptr; } - _LIBCPP_HIDE_FROM_ABI static constexpr _Tp* data() noexcept { return nullptr; } - _LIBCPP_HIDE_FROM_ABI static constexpr size_t size() noexcept { return 0; } - _LIBCPP_HIDE_FROM_ABI static constexpr bool empty() noexcept { return true; } + static constexpr _Tp* begin() noexcept { return nullptr; } + static constexpr _Tp* end() noexcept { return nullptr; } + static constexpr _Tp* data() noexcept { return nullptr; } + static constexpr size_t size() noexcept { return 0; } + static constexpr bool empty() noexcept { return true; } }; template diff --git a/libcxx/include/__ranges/filter_view.h b/libcxx/include/__ranges/filter_view.h index 07980e7353190..ca9f437475ddf 100644 --- a/libcxx/include/__ranges/filter_view.h +++ b/libcxx/include/__ranges/filter_view.h @@ -68,24 +68,24 @@ class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS filter_view : public view_interface && default_initializable<_Pred> = default; - _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 filter_view(_View __base, _Pred __pred) + constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 filter_view(_View __base, _Pred __pred) : __base_(std::move(__base)), __pred_(in_place, std::move(__pred)) {} template - _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& + constexpr _View base() const& requires copy_constructible<_Vp> { return __base_; } - _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); } + constexpr _View base() && { return std::move(__base_); } - _LIBCPP_HIDE_FROM_ABI constexpr _Pred const& pred() const { return *__pred_; } + constexpr _Pred const& pred() const { return *__pred_; } - _LIBCPP_HIDE_FROM_ABI constexpr __iterator begin() { + constexpr __iterator begin() { // Note: this duplicates a check in `optional` but provides a better error message. _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( __pred_.__has_value(), "Trying to call begin() on a filter_view that does not have a valid predicate."); @@ -99,7 +99,7 @@ class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS filter_view : public view_interface) return __iterator{*this, ranges::end(__base_)}; else @@ -141,30 +141,30 @@ class filter_view<_View, _Pred>::__iterator : public __filter_iterator_category< using value_type = range_value_t<_View>; using difference_type = range_difference_t<_View>; - _LIBCPP_HIDE_FROM_ABI __iterator() + __iterator() requires default_initializable> = default; - _LIBCPP_HIDE_FROM_ABI constexpr __iterator(filter_view& __parent, iterator_t<_View> __current) + constexpr __iterator(filter_view& __parent, iterator_t<_View> __current) : __current_(std::move(__current)), __parent_(std::addressof(__parent)) {} - _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_View> const& base() const& noexcept { return __current_; } - _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_View> base() && { return std::move(__current_); } + constexpr iterator_t<_View> const& base() const& noexcept { return __current_; } + constexpr iterator_t<_View> base() && { return std::move(__current_); } - _LIBCPP_HIDE_FROM_ABI constexpr range_reference_t<_View> operator*() const { return *__current_; } - _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_View> operator->() const + constexpr range_reference_t<_View> operator*() const { return *__current_; } + constexpr iterator_t<_View> operator->() const requires __has_arrow> && copyable> { return __current_; } - _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() { + constexpr __iterator& operator++() { __current_ = ranges::find_if(std::move(++__current_), ranges::end(__parent_->__base_), std::ref(*__parent_->__pred_)); return *this; } - _LIBCPP_HIDE_FROM_ABI constexpr void operator++(int) { ++*this; } - _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int) + constexpr void operator++(int) { ++*this; } + constexpr __iterator operator++(int) requires forward_range<_View> { auto __tmp = *this; @@ -172,7 +172,7 @@ class filter_view<_View, _Pred>::__iterator : public __filter_iterator_category< return __tmp; } - _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator--() + constexpr __iterator& operator--() requires bidirectional_range<_View> { do { @@ -180,7 +180,7 @@ class filter_view<_View, _Pred>::__iterator : public __filter_iterator_category< } while (!std::invoke(*__parent_->__pred_, *__current_)); return *this; } - _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator--(int) + constexpr __iterator operator--(int) requires bidirectional_range<_View> { auto __tmp = *this; @@ -188,18 +188,18 @@ class filter_view<_View, _Pred>::__iterator : public __filter_iterator_category< return __tmp; } - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(__iterator const& __x, __iterator const& __y) + friend constexpr bool operator==(__iterator const& __x, __iterator const& __y) requires equality_comparable> { return __x.__current_ == __y.__current_; } - _LIBCPP_HIDE_FROM_ABI friend constexpr range_rvalue_reference_t<_View> + friend constexpr range_rvalue_reference_t<_View> iter_move(__iterator const& __it) noexcept(noexcept(ranges::iter_move(__it.__current_))) { return ranges::iter_move(__it.__current_); } - _LIBCPP_HIDE_FROM_ABI friend constexpr void + friend constexpr void iter_swap(__iterator const& __x, __iterator const& __y) noexcept(noexcept(ranges::iter_swap(__x.__current_, __y.__current_))) requires indirectly_swappable> @@ -214,13 +214,13 @@ class filter_view<_View, _Pred>::__sentinel { public: sentinel_t<_View> __end_ = sentinel_t<_View>(); - _LIBCPP_HIDE_FROM_ABI __sentinel() = default; + __sentinel() = default; - _LIBCPP_HIDE_FROM_ABI constexpr explicit __sentinel(filter_view& __parent) : __end_(ranges::end(__parent.__base_)) {} + constexpr explicit __sentinel(filter_view& __parent) : __end_(ranges::end(__parent.__base_)) {} - _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_View> base() const { return __end_; } + constexpr sentinel_t<_View> base() const { return __end_; } - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(__iterator const& __x, __sentinel const& __y) { + friend constexpr bool operator==(__iterator const& __x, __sentinel const& __y) { return __x.__current_ == __y.__end_; } }; @@ -229,7 +229,7 @@ namespace views { namespace __filter { struct __fn { template - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Pred&& __pred) const + [[nodiscard]] constexpr auto operator()(_Range&& __range, _Pred&& __pred) const noexcept(noexcept(filter_view(std::forward<_Range>(__range), std::forward<_Pred>(__pred)))) -> decltype(filter_view(std::forward<_Range>(__range), std::forward<_Pred>(__pred))) { return filter_view(std::forward<_Range>(__range), std::forward<_Pred>(__pred)); @@ -237,7 +237,7 @@ struct __fn { template requires constructible_from, _Pred> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Pred&& __pred) const + [[nodiscard]] constexpr auto operator()(_Pred&& __pred) const noexcept(is_nothrow_constructible_v, _Pred>) { return __pipeable(std::__bind_back(*this, std::forward<_Pred>(__pred))); } diff --git a/libcxx/include/__ranges/iota_view.h b/libcxx/include/__ranges/iota_view.h index 4b84585258b91..853b7a447d1d0 100644 --- a/libcxx/include/__ranges/iota_view.h +++ b/libcxx/include/__ranges/iota_view.h @@ -119,24 +119,22 @@ class iota_view : public view_interface> { _Start __value_ = _Start(); - _LIBCPP_HIDE_FROM_ABI __iterator() + __iterator() requires default_initializable<_Start> = default; - _LIBCPP_HIDE_FROM_ABI constexpr explicit __iterator(_Start __value) : __value_(std::move(__value)) {} + constexpr explicit __iterator(_Start __value) : __value_(std::move(__value)) {} - _LIBCPP_HIDE_FROM_ABI constexpr _Start operator*() const noexcept(is_nothrow_copy_constructible_v<_Start>) { - return __value_; - } + constexpr _Start operator*() const noexcept(is_nothrow_copy_constructible_v<_Start>) { return __value_; } - _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() { + constexpr __iterator& operator++() { ++__value_; return *this; } - _LIBCPP_HIDE_FROM_ABI constexpr void operator++(int) { ++*this; } + constexpr void operator++(int) { ++*this; } - _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int) + constexpr __iterator operator++(int) requires incrementable<_Start> { auto __tmp = *this; @@ -144,14 +142,14 @@ class iota_view : public view_interface> { return __tmp; } - _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator--() + constexpr __iterator& operator--() requires __decrementable<_Start> { --__value_; return *this; } - _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator--(int) + constexpr __iterator operator--(int) requires __decrementable<_Start> { auto __tmp = *this; @@ -159,7 +157,7 @@ class iota_view : public view_interface> { return __tmp; } - _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator+=(difference_type __n) + constexpr __iterator& operator+=(difference_type __n) requires __advanceable<_Start> { if constexpr (__integer_like<_Start> && !__signed_integer_like<_Start>) { @@ -174,7 +172,7 @@ class iota_view : public view_interface> { return *this; } - _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator-=(difference_type __n) + constexpr __iterator& operator-=(difference_type __n) requires __advanceable<_Start> { if constexpr (__integer_like<_Start> && !__signed_integer_like<_Start>) { @@ -189,69 +187,69 @@ class iota_view : public view_interface> { return *this; } - _LIBCPP_HIDE_FROM_ABI constexpr _Start operator[](difference_type __n) const + constexpr _Start operator[](difference_type __n) const requires __advanceable<_Start> { return _Start(__value_ + __n); } - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __iterator& __y) + friend constexpr bool operator==(const __iterator& __x, const __iterator& __y) requires equality_comparable<_Start> { return __x.__value_ == __y.__value_; } - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(const __iterator& __x, const __iterator& __y) + friend constexpr bool operator<(const __iterator& __x, const __iterator& __y) requires totally_ordered<_Start> { return __x.__value_ < __y.__value_; } - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(const __iterator& __x, const __iterator& __y) + friend constexpr bool operator>(const __iterator& __x, const __iterator& __y) requires totally_ordered<_Start> { return __y < __x; } - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(const __iterator& __x, const __iterator& __y) + friend constexpr bool operator<=(const __iterator& __x, const __iterator& __y) requires totally_ordered<_Start> { return !(__y < __x); } - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(const __iterator& __x, const __iterator& __y) + friend constexpr bool operator>=(const __iterator& __x, const __iterator& __y) requires totally_ordered<_Start> { return !(__x < __y); } - _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator<=>(const __iterator& __x, const __iterator& __y) + friend constexpr auto operator<=>(const __iterator& __x, const __iterator& __y) requires totally_ordered<_Start> && three_way_comparable<_Start> { return __x.__value_ <=> __y.__value_; } - _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(__iterator __i, difference_type __n) + friend constexpr __iterator operator+(__iterator __i, difference_type __n) requires __advanceable<_Start> { __i += __n; return __i; } - _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, __iterator __i) + friend constexpr __iterator operator+(difference_type __n, __iterator __i) requires __advanceable<_Start> { return __i + __n; } - _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(__iterator __i, difference_type __n) + friend constexpr __iterator operator-(__iterator __i, difference_type __n) requires __advanceable<_Start> { __i -= __n; return __i; } - _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y) + friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y) requires __advanceable<_Start> { if constexpr (__integer_like<_Start>) { @@ -274,23 +272,20 @@ class iota_view : public view_interface> { _BoundSentinel __bound_sentinel_ = _BoundSentinel(); public: - _LIBCPP_HIDE_FROM_ABI __sentinel() = default; - _LIBCPP_HIDE_FROM_ABI constexpr explicit __sentinel(_BoundSentinel __bound_sentinel) - : __bound_sentinel_(std::move(__bound_sentinel)) {} + __sentinel() = default; + constexpr explicit __sentinel(_BoundSentinel __bound_sentinel) : __bound_sentinel_(std::move(__bound_sentinel)) {} - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __sentinel& __y) { + friend constexpr bool operator==(const __iterator& __x, const __sentinel& __y) { return __x.__value_ == __y.__bound_sentinel_; } - _LIBCPP_HIDE_FROM_ABI friend constexpr iter_difference_t<_Start> - operator-(const __iterator& __x, const __sentinel& __y) + friend constexpr iter_difference_t<_Start> operator-(const __iterator& __x, const __sentinel& __y) requires sized_sentinel_for<_BoundSentinel, _Start> { return __x.__value_ - __y.__bound_sentinel_; } - _LIBCPP_HIDE_FROM_ABI friend constexpr iter_difference_t<_Start> - operator-(const __sentinel& __x, const __iterator& __y) + friend constexpr iter_difference_t<_Start> operator-(const __sentinel& __x, const __iterator& __y) requires sized_sentinel_for<_BoundSentinel, _Start> { return -(__y - __x); @@ -301,13 +296,13 @@ class iota_view : public view_interface> { _BoundSentinel __bound_sentinel_ = _BoundSentinel(); public: - _LIBCPP_HIDE_FROM_ABI iota_view() + iota_view() requires default_initializable<_Start> = default; - _LIBCPP_HIDE_FROM_ABI constexpr explicit iota_view(_Start __value) : __value_(std::move(__value)) {} + constexpr explicit iota_view(_Start __value) : __value_(std::move(__value)) {} - _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 + constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 iota_view(type_identity_t<_Start> __value, type_identity_t<_BoundSentinel> __bound_sentinel) : __value_(std::move(__value)), __bound_sentinel_(std::move(__bound_sentinel)) { // Validate the precondition if possible. @@ -317,36 +312,36 @@ class iota_view : public view_interface> { } } - _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 iota_view(__iterator __first, __iterator __last) + constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 iota_view(__iterator __first, __iterator __last) requires same_as<_Start, _BoundSentinel> : iota_view(std::move(__first.__value_), std::move(__last.__value_)) {} - _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 iota_view(__iterator __first, _BoundSentinel __last) + constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 iota_view(__iterator __first, _BoundSentinel __last) requires same_as<_BoundSentinel, unreachable_sentinel_t> : iota_view(std::move(__first.__value_), std::move(__last)) {} - _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 iota_view(__iterator __first, __sentinel __last) + constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 iota_view(__iterator __first, __sentinel __last) requires(!same_as<_Start, _BoundSentinel> && !same_as<_BoundSentinel, unreachable_sentinel_t>) : iota_view(std::move(__first.__value_), std::move(__last.__bound_sentinel_)) {} - _LIBCPP_HIDE_FROM_ABI constexpr __iterator begin() const { return __iterator{__value_}; } + constexpr __iterator begin() const { return __iterator{__value_}; } - _LIBCPP_HIDE_FROM_ABI constexpr auto end() const { + constexpr auto end() const { if constexpr (same_as<_BoundSentinel, unreachable_sentinel_t>) return unreachable_sentinel; else return __sentinel{__bound_sentinel_}; } - _LIBCPP_HIDE_FROM_ABI constexpr __iterator end() const + constexpr __iterator end() const requires same_as<_Start, _BoundSentinel> { return __iterator{__bound_sentinel_}; } - _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const { return __value_ == __bound_sentinel_; } + constexpr bool empty() const { return __value_ == __bound_sentinel_; } - _LIBCPP_HIDE_FROM_ABI constexpr auto size() const + constexpr auto size() const requires(same_as<_Start, _BoundSentinel> && __advanceable<_Start>) || (integral<_Start> && integral<_BoundSentinel>) || sized_sentinel_for<_BoundSentinel, _Start> { @@ -374,14 +369,13 @@ namespace views { namespace __iota { struct __fn { template - _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Start&& __start) const - noexcept(noexcept(ranges::iota_view(std::forward<_Start>(__start)))) - -> decltype(ranges::iota_view(std::forward<_Start>(__start))) { + constexpr auto operator()(_Start&& __start) const noexcept(noexcept(ranges::iota_view(std::forward<_Start>(__start)))) + -> decltype(ranges::iota_view(std::forward<_Start>(__start))) { return ranges::iota_view(std::forward<_Start>(__start)); } template - _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Start&& __start, _BoundSentinel&& __bound_sentinel) const noexcept( + constexpr auto operator()(_Start&& __start, _BoundSentinel&& __bound_sentinel) const noexcept( noexcept(ranges::iota_view(std::forward<_Start>(__start), std::forward<_BoundSentinel>(__bound_sentinel)))) -> decltype(ranges::iota_view(std::forward<_Start>(__start), std::forward<_BoundSentinel>(__bound_sentinel))) { return ranges::iota_view(std::forward<_Start>(__start), std::forward<_BoundSentinel>(__bound_sentinel)); diff --git a/libcxx/include/__ranges/istream_view.h b/libcxx/include/__ranges/istream_view.h index ab05cb6ef1fe3..3bd6e499fc823 100644 --- a/libcxx/include/__ranges/istream_view.h +++ b/libcxx/include/__ranges/istream_view.h @@ -43,15 +43,15 @@ class basic_istream_view : public view_interface& __stream) + constexpr explicit basic_istream_view(basic_istream<_CharT, _Traits>& __stream) : __stream_(std::addressof(__stream)) {} - _LIBCPP_HIDE_FROM_ABI constexpr auto begin() { + constexpr auto begin() { *__stream_ >> __value_; return __iterator{*this}; } - _LIBCPP_HIDE_FROM_ABI constexpr default_sentinel_t end() const noexcept { return default_sentinel; } + constexpr default_sentinel_t end() const noexcept { return default_sentinel; } private: basic_istream<_CharT, _Traits>* __stream_; @@ -66,34 +66,30 @@ class basic_istream_view<_Val, _CharT, _Traits>::__iterator { using difference_type = ptrdiff_t; using value_type = _Val; - _LIBCPP_HIDE_FROM_ABI constexpr explicit __iterator(basic_istream_view<_Val, _CharT, _Traits>& __parent) noexcept + constexpr explicit __iterator(basic_istream_view<_Val, _CharT, _Traits>& __parent) noexcept : __parent_(std::addressof(__parent)) {} - __iterator(const __iterator&) = delete; - _LIBCPP_HIDE_FROM_ABI __iterator(__iterator&&) = default; + __iterator(const __iterator&) = delete; + __iterator(__iterator&&) = default; - __iterator& operator=(const __iterator&) = delete; - _LIBCPP_HIDE_FROM_ABI __iterator& operator=(__iterator&&) = default; + __iterator& operator=(const __iterator&) = delete; + __iterator& operator=(__iterator&&) = default; - _LIBCPP_HIDE_FROM_ABI __iterator& operator++() { + __iterator& operator++() { *__parent_->__stream_ >> __parent_->__value_; return *this; } - _LIBCPP_HIDE_FROM_ABI void operator++(int) { ++*this; } + void operator++(int) { ++*this; } - _LIBCPP_HIDE_FROM_ABI _Val& operator*() const { return __parent_->__value_; } + _Val& operator*() const { return __parent_->__value_; } - _LIBCPP_HIDE_FROM_ABI friend bool operator==(const __iterator& __x, default_sentinel_t) { - return !*__x.__get_parent_stream(); - } + friend bool operator==(const __iterator& __x, default_sentinel_t) { return !*__x.__get_parent_stream(); } private: basic_istream_view<_Val, _CharT, _Traits>* __parent_; - _LIBCPP_HIDE_FROM_ABI constexpr basic_istream<_CharT, _Traits>* __get_parent_stream() const { - return __parent_->__stream_; - } + constexpr basic_istream<_CharT, _Traits>* __get_parent_stream() const { return __parent_->__stream_; } }; template @@ -113,7 +109,7 @@ struct __fn { template > requires derived_from<_UnCVRef, basic_istream> - _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Up&& __u) const + constexpr auto operator()(_Up&& __u) const noexcept(noexcept(basic_istream_view<_Tp, typename _UnCVRef::char_type, typename _UnCVRef::traits_type>(std::forward<_Up>(__u)))) -> decltype( basic_istream_view<_Tp, typename _UnCVRef::char_type, diff --git a/libcxx/include/__ranges/join_view.h b/libcxx/include/__ranges/join_view.h index 327b349f476a7..196a995ddc75c 100644 --- a/libcxx/include/__ranges/join_view.h +++ b/libcxx/include/__ranges/join_view.h @@ -94,21 +94,21 @@ class join_view : public view_interface> { _LIBCPP_NO_UNIQUE_ADDRESS _InnerCache __inner_; public: - _LIBCPP_HIDE_FROM_ABI join_view() + join_view() requires default_initializable<_View> = default; - _LIBCPP_HIDE_FROM_ABI constexpr explicit join_view(_View __base) : __base_(std::move(__base)) {} + constexpr explicit join_view(_View __base) : __base_(std::move(__base)) {} - _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& + constexpr _View base() const& requires copy_constructible<_View> { return __base_; } - _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); } + constexpr _View base() && { return std::move(__base_); } - _LIBCPP_HIDE_FROM_ABI constexpr auto begin() { + constexpr auto begin() { if constexpr (forward_range<_View>) { constexpr bool __use_const = __simple_view<_View> && is_reference_v>; return __iterator<__use_const>{*this, ranges::begin(__base_)}; @@ -119,14 +119,14 @@ class join_view : public view_interface> { } template - _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const + constexpr auto begin() const requires forward_range && is_reference_v> && input_range> { return __iterator{*this, ranges::begin(__base_)}; } - _LIBCPP_HIDE_FROM_ABI constexpr auto end() { + constexpr auto end() { if constexpr (forward_range<_View> && is_reference_v<_InnerRange> && forward_range<_InnerRange> && common_range<_View> && common_range<_InnerRange>) return __iterator<__simple_view<_View>>{*this, ranges::end(__base_)}; @@ -135,7 +135,7 @@ class join_view : public view_interface> { } template - _LIBCPP_HIDE_FROM_ABI constexpr auto end() const + constexpr auto end() const requires forward_range && is_reference_v> && input_range> { @@ -161,17 +161,17 @@ struct join_view<_View>::__sentinel { sentinel_t<_Base> __end_ = sentinel_t<_Base>(); public: - _LIBCPP_HIDE_FROM_ABI __sentinel() = default; + __sentinel() = default; - _LIBCPP_HIDE_FROM_ABI constexpr explicit __sentinel(_Parent& __parent) : __end_(ranges::end(__parent.__base_)) {} + constexpr explicit __sentinel(_Parent& __parent) : __end_(ranges::end(__parent.__base_)) {} - _LIBCPP_HIDE_FROM_ABI constexpr __sentinel(__sentinel __s) + constexpr __sentinel(__sentinel __s) requires _Const && convertible_to, sentinel_t<_Base>> : __end_(std::move(__s.__end_)) {} template requires sentinel_for, iterator_t<__maybe_const<_OtherConst, _View>>> - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator<_OtherConst>& __x, const __sentinel& __y) { + friend constexpr bool operator==(const __iterator<_OtherConst>& __x, const __sentinel& __y) { return __x.__get_outer() == __y.__end_; } }; @@ -208,7 +208,7 @@ struct join_view<_View>::__iterator final : public __join_view_iterator_category optional<_Inner> __inner_; _Parent* __parent_ = nullptr; - _LIBCPP_HIDE_FROM_ABI constexpr void __satisfy() { + constexpr void __satisfy() { for (; __get_outer() != ranges::end(__parent_->__base_); ++__get_outer()) { auto&& __inner = [this]() -> auto&& { if constexpr (__ref_is_glvalue) @@ -225,7 +225,7 @@ struct join_view<_View>::__iterator final : public __join_view_iterator_category __inner_.reset(); } - _LIBCPP_HIDE_FROM_ABI constexpr _Outer& __get_outer() { + constexpr _Outer& __get_outer() { if constexpr (forward_range<_Base>) { return __outer_; } else { @@ -233,7 +233,7 @@ struct join_view<_View>::__iterator final : public __join_view_iterator_category } } - _LIBCPP_HIDE_FROM_ABI constexpr const _Outer& __get_outer() const { + constexpr const _Outer& __get_outer() const { if constexpr (forward_range<_Base>) { return __outer_; } else { @@ -241,19 +241,19 @@ struct join_view<_View>::__iterator final : public __join_view_iterator_category } } - _LIBCPP_HIDE_FROM_ABI constexpr __iterator(_Parent& __parent, _Outer __outer) + constexpr __iterator(_Parent& __parent, _Outer __outer) requires forward_range<_Base> : __outer_(std::move(__outer)), __parent_(std::addressof(__parent)) { __satisfy(); } - _LIBCPP_HIDE_FROM_ABI constexpr explicit __iterator(_Parent& __parent) + constexpr explicit __iterator(_Parent& __parent) requires(!forward_range<_Base>) : __parent_(std::addressof(__parent)) { __satisfy(); } - _LIBCPP_HIDE_FROM_ABI constexpr __iterator(_Parent* __parent, _Outer __outer, _Inner __inner) + constexpr __iterator(_Parent* __parent, _Outer __outer, _Inner __inner) requires forward_range<_Base> : __outer_(std::move(__outer)), __inner_(std::move(__inner)), __parent_(__parent) {} @@ -270,21 +270,21 @@ struct join_view<_View>::__iterator final : public __join_view_iterator_category using difference_type = common_type_t< range_difference_t<_Base>, range_difference_t>>; - _LIBCPP_HIDE_FROM_ABI __iterator() = default; + __iterator() = default; - _LIBCPP_HIDE_FROM_ABI constexpr __iterator(__iterator __i) + constexpr __iterator(__iterator __i) requires _Const && convertible_to, _Outer> && convertible_to, _Inner> : __outer_(std::move(__i.__outer_)), __inner_(std::move(__i.__inner_)), __parent_(__i.__parent_) {} - _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const { return **__inner_; } + constexpr decltype(auto) operator*() const { return **__inner_; } - _LIBCPP_HIDE_FROM_ABI constexpr _Inner operator->() const + constexpr _Inner operator->() const requires __has_arrow<_Inner> && copyable<_Inner> { return *__inner_; } - _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() { + constexpr __iterator& operator++() { auto __get_inner_range = [&]() -> decltype(auto) { if constexpr (__ref_is_glvalue) return *__get_outer(); @@ -298,9 +298,9 @@ struct join_view<_View>::__iterator final : public __join_view_iterator_category return *this; } - _LIBCPP_HIDE_FROM_ABI constexpr void operator++(int) { ++*this; } + constexpr void operator++(int) { ++*this; } - _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int) + constexpr __iterator operator++(int) requires __ref_is_glvalue && forward_range<_Base> && forward_range> { auto __tmp = *this; @@ -308,7 +308,7 @@ struct join_view<_View>::__iterator final : public __join_view_iterator_category return __tmp; } - _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator--() + constexpr __iterator& operator--() requires __ref_is_glvalue && bidirectional_range<_Base> && bidirectional_range> && common_range> { @@ -324,7 +324,7 @@ struct join_view<_View>::__iterator final : public __join_view_iterator_category return *this; } - _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator--(int) + constexpr __iterator operator--(int) requires __ref_is_glvalue && bidirectional_range<_Base> && bidirectional_range> && common_range> { @@ -333,18 +333,18 @@ struct join_view<_View>::__iterator final : public __join_view_iterator_category return __tmp; } - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __iterator& __y) + friend constexpr bool operator==(const __iterator& __x, const __iterator& __y) requires __ref_is_glvalue && forward_range<_Base> && equality_comparable>> { return __x.__outer_ == __y.__outer_ && __x.__inner_ == __y.__inner_; } - _LIBCPP_HIDE_FROM_ABI friend constexpr decltype(auto) + friend constexpr decltype(auto) iter_move(const __iterator& __i) noexcept(noexcept(ranges::iter_move(*__i.__inner_))) { return ranges::iter_move(*__i.__inner_); } - _LIBCPP_HIDE_FROM_ABI friend constexpr void + friend constexpr void iter_swap(const __iterator& __x, const __iterator& __y) noexcept(noexcept(ranges::iter_swap(*__x.__inner_, *__y.__inner_))) requires indirectly_swappable<_Inner> @@ -360,7 +360,7 @@ namespace views { namespace __join_view { struct __fn : __range_adaptor_closure<__fn> { template - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const + [[nodiscard]] constexpr auto operator()(_Range&& __range) const noexcept(noexcept(join_view>(std::forward<_Range>(__range)))) -> decltype(join_view>(std::forward<_Range>(__range))) { return join_view>(std::forward<_Range>(__range)); @@ -384,7 +384,7 @@ struct __segmented_iterator_traits<_JoinViewIterator> { // TODO: Would it make sense to enable the optimization for other iterator types? - static constexpr _LIBCPP_HIDE_FROM_ABI __segment_iterator __segment(_JoinViewIterator __iter) { + static constexpr __segment_iterator __segment(_JoinViewIterator __iter) { if (ranges::empty(__iter.__parent_->__base_)) return {}; if (!__iter.__inner_.has_value()) @@ -392,7 +392,7 @@ struct __segmented_iterator_traits<_JoinViewIterator> { return __segment_iterator(__iter.__outer_, __iter.__parent_); } - static constexpr _LIBCPP_HIDE_FROM_ABI __local_iterator __local(_JoinViewIterator __iter) { + static constexpr __local_iterator __local(_JoinViewIterator __iter) { if (ranges::empty(__iter.__parent_->__base_)) return {}; if (!__iter.__inner_.has_value()) @@ -400,16 +400,11 @@ struct __segmented_iterator_traits<_JoinViewIterator> { return *__iter.__inner_; } - static constexpr _LIBCPP_HIDE_FROM_ABI __local_iterator __begin(__segment_iterator __iter) { - return ranges::begin(*__iter.__get_iter()); - } + static constexpr __local_iterator __begin(__segment_iterator __iter) { return ranges::begin(*__iter.__get_iter()); } - static constexpr _LIBCPP_HIDE_FROM_ABI __local_iterator __end(__segment_iterator __iter) { - return ranges::end(*__iter.__get_iter()); - } + static constexpr __local_iterator __end(__segment_iterator __iter) { return ranges::end(*__iter.__get_iter()); } - static constexpr _LIBCPP_HIDE_FROM_ABI _JoinViewIterator - __compose(__segment_iterator __seg_iter, __local_iterator __local_iter) { + static constexpr _JoinViewIterator __compose(__segment_iterator __seg_iter, __local_iterator __local_iter) { return _JoinViewIterator( std::move(__seg_iter).__get_data(), std::move(__seg_iter).__get_iter(), std::move(__local_iter)); } diff --git a/libcxx/include/__ranges/lazy_split_view.h b/libcxx/include/__ranges/lazy_split_view.h index cca9191d26818..f37e654a50ebc 100644 --- a/libcxx/include/__ranges/lazy_split_view.h +++ b/libcxx/include/__ranges/lazy_split_view.h @@ -82,48 +82,48 @@ class lazy_split_view : public view_interface> struct __inner_iterator; public: - _LIBCPP_HIDE_FROM_ABI lazy_split_view() + lazy_split_view() requires default_initializable<_View> && default_initializable<_Pattern> = default; - _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 lazy_split_view(_View __base, _Pattern __pattern) + constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 lazy_split_view(_View __base, _Pattern __pattern) : __base_(std::move(__base)), __pattern_(std::move(__pattern)) {} template requires constructible_from<_View, views::all_t<_Range>> && constructible_from<_Pattern, single_view>> - _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 lazy_split_view(_Range&& __r, range_value_t<_Range> __e) + constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 lazy_split_view(_Range&& __r, range_value_t<_Range> __e) : __base_(views::all(std::forward<_Range>(__r))), __pattern_(views::single(std::move(__e))) {} - _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& + constexpr _View base() const& requires copy_constructible<_View> { return __base_; } - _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); } + constexpr _View base() && { return std::move(__base_); } - _LIBCPP_HIDE_FROM_ABI constexpr auto begin() { + constexpr auto begin() { if constexpr (forward_range<_View>) { - return __outer_iterator < __simple_view<_View> && __simple_view < _Pattern >> {*this, ranges::begin(__base_)}; + return __outer_iterator<__simple_view<_View> && __simple_view< _Pattern >>{*this, ranges::begin(__base_)}; } else { __current_.__emplace(ranges::begin(__base_)); return __outer_iterator{*this}; } } - _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const + constexpr auto begin() const requires forward_range<_View> && forward_range { return __outer_iterator{*this, ranges::begin(__base_)}; } - _LIBCPP_HIDE_FROM_ABI constexpr auto end() + constexpr auto end() requires forward_range<_View> && common_range<_View> { - return __outer_iterator < __simple_view<_View> && __simple_view < _Pattern >> {*this, ranges::end(__base_)}; + return __outer_iterator< __simple_view<_View> && __simple_view< _Pattern >>{*this, ranges::end(__base_)}; } - _LIBCPP_HIDE_FROM_ABI constexpr auto end() const { + constexpr auto end() const { if constexpr (forward_range<_View> && forward_range && common_range) { return __outer_iterator{*this, ranges::end(__base_)}; } else { @@ -155,7 +155,7 @@ class lazy_split_view : public view_interface> _LIBCPP_NO_UNIQUE_ADDRESS _MaybeCurrent __current_ = _MaybeCurrent(); bool __trailing_empty_ = false; - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto& __current() noexcept { + [[nodiscard]] constexpr auto& __current() noexcept { if constexpr (forward_range<_View>) { return __current_; } else { @@ -163,7 +163,7 @@ class lazy_split_view : public view_interface> } } - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const auto& __current() const noexcept { + [[nodiscard]] constexpr const auto& __current() const noexcept { if constexpr (forward_range<_View>) { return __current_; } else { @@ -173,7 +173,7 @@ class lazy_split_view : public view_interface> // Workaround for the GCC issue that doesn't allow calling `__parent_->__base_` from friend functions (because // `__base_` is private). - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto& __parent_base() const noexcept { return __parent_->__base_; } + [[nodiscard]] constexpr auto& __parent_base() const noexcept { return __parent_->__base_; } public: // using iterator_category = inherited; @@ -185,30 +185,30 @@ class lazy_split_view : public view_interface> __outer_iterator __i_ = __outer_iterator(); public: - _LIBCPP_HIDE_FROM_ABI value_type() = default; - _LIBCPP_HIDE_FROM_ABI constexpr explicit value_type(__outer_iterator __i) : __i_(std::move(__i)) {} + value_type() = default; + constexpr explicit value_type(__outer_iterator __i) : __i_(std::move(__i)) {} - _LIBCPP_HIDE_FROM_ABI constexpr __inner_iterator<_Const> begin() const { return __inner_iterator<_Const>{__i_}; } - _LIBCPP_HIDE_FROM_ABI constexpr default_sentinel_t end() const noexcept { return default_sentinel; } + constexpr __inner_iterator<_Const> begin() const { return __inner_iterator<_Const>{__i_}; } + constexpr default_sentinel_t end() const noexcept { return default_sentinel; } }; - _LIBCPP_HIDE_FROM_ABI __outer_iterator() = default; + __outer_iterator() = default; - _LIBCPP_HIDE_FROM_ABI constexpr explicit __outer_iterator(_Parent& __parent) + constexpr explicit __outer_iterator(_Parent& __parent) requires(!forward_range<_Base>) : __parent_(std::addressof(__parent)) {} - _LIBCPP_HIDE_FROM_ABI constexpr __outer_iterator(_Parent& __parent, iterator_t<_Base> __current) + constexpr __outer_iterator(_Parent& __parent, iterator_t<_Base> __current) requires forward_range<_Base> : __parent_(std::addressof(__parent)), __current_(std::move(__current)) {} - _LIBCPP_HIDE_FROM_ABI constexpr __outer_iterator(__outer_iterator __i) + constexpr __outer_iterator(__outer_iterator __i) requires _Const && convertible_to, iterator_t<_Base>> : __parent_(__i.__parent_), __current_(std::move(__i.__current_)) {} - _LIBCPP_HIDE_FROM_ABI constexpr value_type operator*() const { return value_type{*this}; } + constexpr value_type operator*() const { return value_type{*this}; } - _LIBCPP_HIDE_FROM_ABI constexpr __outer_iterator& operator++() { + constexpr __outer_iterator& operator++() { const auto __end = ranges::end(__parent_->__base_); if (__current() == __end) { __trailing_empty_ = false; @@ -247,7 +247,7 @@ class lazy_split_view : public view_interface> return *this; } - _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator++(int) { + constexpr decltype(auto) operator++(int) { if constexpr (forward_range<_Base>) { auto __tmp = *this; ++*this; @@ -258,13 +258,13 @@ class lazy_split_view : public view_interface> } } - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __outer_iterator& __x, const __outer_iterator& __y) + friend constexpr bool operator==(const __outer_iterator& __x, const __outer_iterator& __y) requires forward_range<_Base> { return __x.__current_ == __y.__current_ && __x.__trailing_empty_ == __y.__trailing_empty_; } - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __outer_iterator& __x, default_sentinel_t) { + friend constexpr bool operator==(const __outer_iterator& __x, default_sentinel_t) { _LIBCPP_ASSERT_NON_NULL(__x.__parent_ != nullptr, "Cannot call comparison on a default-constructed iterator."); return __x.__current() == ranges::end(__x.__parent_base()) && !__x.__trailing_empty_; } @@ -293,7 +293,7 @@ class lazy_split_view : public view_interface> // Note: these private functions are necessary because GCC doesn't allow calls to private members of `__i_` from // free functions that are friends of `inner-iterator`. - _LIBCPP_HIDE_FROM_ABI constexpr bool __is_done() const { + constexpr bool __is_done() const { _LIBCPP_ASSERT_NON_NULL(__i_.__parent_ != nullptr, "Cannot call comparison on a default-constructed iterator."); auto [__pcur, __pend] = ranges::subrange{__i_.__parent_->__pattern_}; @@ -326,11 +326,9 @@ class lazy_split_view : public view_interface> } } - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto& __outer_current() noexcept { return __i_.__current(); } + [[nodiscard]] constexpr auto& __outer_current() noexcept { return __i_.__current(); } - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const auto& __outer_current() const noexcept { - return __i_.__current(); - } + [[nodiscard]] constexpr const auto& __outer_current() const noexcept { return __i_.__current(); } public: // using iterator_category = inherited; @@ -338,20 +336,20 @@ class lazy_split_view : public view_interface> using value_type = range_value_t<_Base>; using difference_type = range_difference_t<_Base>; - _LIBCPP_HIDE_FROM_ABI __inner_iterator() = default; + __inner_iterator() = default; - _LIBCPP_HIDE_FROM_ABI constexpr explicit __inner_iterator(__outer_iterator<_Const> __i) : __i_(std::move(__i)) {} + constexpr explicit __inner_iterator(__outer_iterator<_Const> __i) : __i_(std::move(__i)) {} - _LIBCPP_HIDE_FROM_ABI constexpr const iterator_t<_Base>& base() const& noexcept { return __i_.__current(); } - _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Base> base() && + constexpr const iterator_t<_Base>& base() const& noexcept { return __i_.__current(); } + constexpr iterator_t<_Base> base() && requires forward_range<_View> { return std::move(__i_.__current()); } - _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const { return *__i_.__current(); } + constexpr decltype(auto) operator*() const { return *__i_.__current(); } - _LIBCPP_HIDE_FROM_ABI constexpr __inner_iterator& operator++() { + constexpr __inner_iterator& operator++() { __incremented_ = true; if constexpr (!forward_range<_Base>) { @@ -364,7 +362,7 @@ class lazy_split_view : public view_interface> return *this; } - _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator++(int) { + constexpr decltype(auto) operator++(int) { if constexpr (forward_range<_Base>) { auto __tmp = *this; ++*this; @@ -375,24 +373,21 @@ class lazy_split_view : public view_interface> } } - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __inner_iterator& __x, const __inner_iterator& __y) + friend constexpr bool operator==(const __inner_iterator& __x, const __inner_iterator& __y) requires forward_range<_Base> { return __x.__outer_current() == __y.__outer_current(); } - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __inner_iterator& __x, default_sentinel_t) { - return __x.__is_done(); - } + friend constexpr bool operator==(const __inner_iterator& __x, default_sentinel_t) { return __x.__is_done(); } - _LIBCPP_HIDE_FROM_ABI friend constexpr decltype(auto) + friend constexpr decltype(auto) iter_move(const __inner_iterator& __i) noexcept(noexcept(ranges::iter_move(__i.__outer_current()))) { return ranges::iter_move(__i.__outer_current()); } - _LIBCPP_HIDE_FROM_ABI friend constexpr void iter_swap( - const __inner_iterator& __x, - const __inner_iterator& __y) noexcept(noexcept(ranges::iter_swap(__x.__outer_current(), __y.__outer_current()))) + friend constexpr void iter_swap(const __inner_iterator& __x, const __inner_iterator& __y) noexcept( + noexcept(ranges::iter_swap(__x.__outer_current(), __y.__outer_current()))) requires indirectly_swappable> { ranges::iter_swap(__x.__outer_current(), __y.__outer_current()); @@ -404,14 +399,14 @@ template lazy_split_view(_Range&&, _Pattern&&) -> lazy_split_view, views::all_t<_Pattern>>; template -lazy_split_view(_Range&&, - range_value_t<_Range>) -> lazy_split_view, single_view>>; +lazy_split_view(_Range&&, range_value_t<_Range>) + -> lazy_split_view, single_view>>; namespace views { namespace __lazy_split_view { struct __fn { template - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Pattern&& __pattern) const + [[nodiscard]] constexpr auto operator()(_Range&& __range, _Pattern&& __pattern) const noexcept(noexcept(lazy_split_view(std::forward<_Range>(__range), std::forward<_Pattern>(__pattern)))) -> decltype(lazy_split_view(std::forward<_Range>(__range), std::forward<_Pattern>(__pattern))) { return lazy_split_view(std::forward<_Range>(__range), std::forward<_Pattern>(__pattern)); @@ -419,7 +414,7 @@ struct __fn { template requires constructible_from, _Pattern> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Pattern&& __pattern) const + [[nodiscard]] constexpr auto operator()(_Pattern&& __pattern) const noexcept(is_nothrow_constructible_v, _Pattern>) { return __pipeable(std::__bind_back(*this, std::forward<_Pattern>(__pattern))); } diff --git a/libcxx/include/__ranges/movable_box.h b/libcxx/include/__ranges/movable_box.h index 5a456cc3a1b66..278862702a442 100644 --- a/libcxx/include/__ranges/movable_box.h +++ b/libcxx/include/__ranges/movable_box.h @@ -59,19 +59,17 @@ class __movable_box { public: template requires is_constructible_v<_Tp, _Args...> - _LIBCPP_HIDE_FROM_ABI constexpr explicit __movable_box(in_place_t, _Args&&... __args) noexcept( - is_nothrow_constructible_v<_Tp, _Args...>) + constexpr explicit __movable_box(in_place_t, _Args&&... __args) noexcept(is_nothrow_constructible_v<_Tp, _Args...>) : __val_(in_place, std::forward<_Args>(__args)...) {} - _LIBCPP_HIDE_FROM_ABI constexpr __movable_box() noexcept(is_nothrow_default_constructible_v<_Tp>) + constexpr __movable_box() noexcept(is_nothrow_default_constructible_v<_Tp>) requires default_initializable<_Tp> : __val_(in_place) {} - _LIBCPP_HIDE_FROM_ABI __movable_box(__movable_box const&) = default; - _LIBCPP_HIDE_FROM_ABI __movable_box(__movable_box&&) = default; + __movable_box(__movable_box const&) = default; + __movable_box(__movable_box&&) = default; - _LIBCPP_HIDE_FROM_ABI constexpr __movable_box& - operator=(__movable_box const& __other) noexcept(is_nothrow_copy_constructible_v<_Tp>) + constexpr __movable_box& operator=(__movable_box const& __other) noexcept(is_nothrow_copy_constructible_v<_Tp>) # if _LIBCPP_STD_VER >= 23 requires copy_constructible<_Tp> # endif @@ -85,12 +83,11 @@ class __movable_box { return *this; } - _LIBCPP_HIDE_FROM_ABI __movable_box& operator=(__movable_box&&) + __movable_box& operator=(__movable_box&&) requires movable<_Tp> = default; - _LIBCPP_HIDE_FROM_ABI constexpr __movable_box& - operator=(__movable_box&& __other) noexcept(is_nothrow_move_constructible_v<_Tp>) { + constexpr __movable_box& operator=(__movable_box&& __other) noexcept(is_nothrow_move_constructible_v<_Tp>) { if (this != std::addressof(__other)) { if (__other.__has_value()) __val_.emplace(std::move(*__other)); @@ -100,13 +97,13 @@ class __movable_box { return *this; } - _LIBCPP_HIDE_FROM_ABI constexpr _Tp const& operator*() const noexcept { return *__val_; } - _LIBCPP_HIDE_FROM_ABI constexpr _Tp& operator*() noexcept { return *__val_; } + constexpr _Tp const& operator*() const noexcept { return *__val_; } + constexpr _Tp& operator*() noexcept { return *__val_; } - _LIBCPP_HIDE_FROM_ABI constexpr const _Tp* operator->() const noexcept { return __val_.operator->(); } - _LIBCPP_HIDE_FROM_ABI constexpr _Tp* operator->() noexcept { return __val_.operator->(); } + constexpr const _Tp* operator->() const noexcept { return __val_.operator->(); } + constexpr _Tp* operator->() noexcept { return __val_.operator->(); } - _LIBCPP_HIDE_FROM_ABI constexpr bool __has_value() const noexcept { return __val_.has_value(); } + constexpr bool __has_value() const noexcept { return __val_.has_value(); } }; // This partial specialization implements an optimization for when we know we don't need to store @@ -166,8 +163,7 @@ struct __movable_box_holder { _Tp __val_; template - _LIBCPP_HIDE_FROM_ABI constexpr explicit __movable_box_holder(in_place_t, _Args&&... __args) - : __val_(std::forward<_Args>(__args)...) {} + constexpr explicit __movable_box_holder(in_place_t, _Args&&... __args) : __val_(std::forward<_Args>(__args)...) {} }; template @@ -176,8 +172,7 @@ struct __movable_box_holder<_Tp> { _LIBCPP_NO_UNIQUE_ADDRESS _Tp __val_; template - _LIBCPP_HIDE_FROM_ABI constexpr explicit __movable_box_holder(in_place_t, _Args&&... __args) - : __val_(std::forward<_Args>(__args)...) {} + constexpr explicit __movable_box_holder(in_place_t, _Args&&... __args) : __val_(std::forward<_Args>(__args)...) {} }; template <__movable_box_object _Tp> @@ -188,27 +183,27 @@ class __movable_box<_Tp> { public: template requires is_constructible_v<_Tp, _Args...> - _LIBCPP_HIDE_FROM_ABI constexpr explicit __movable_box(in_place_t __inplace, _Args&&... __args) noexcept( - is_nothrow_constructible_v<_Tp, _Args...>) + constexpr explicit __movable_box(in_place_t __inplace, + _Args&&... __args) noexcept(is_nothrow_constructible_v<_Tp, _Args...>) : __holder_(__inplace, std::forward<_Args>(__args)...) {} - _LIBCPP_HIDE_FROM_ABI constexpr __movable_box() noexcept(is_nothrow_default_constructible_v<_Tp>) + constexpr __movable_box() noexcept(is_nothrow_default_constructible_v<_Tp>) requires default_initializable<_Tp> : __holder_(in_place_t{}) {} - _LIBCPP_HIDE_FROM_ABI __movable_box(__movable_box const&) = default; - _LIBCPP_HIDE_FROM_ABI __movable_box(__movable_box&&) = default; + __movable_box(__movable_box const&) = default; + __movable_box(__movable_box&&) = default; // Implementation of assignment operators in case we perform optimization (1) - _LIBCPP_HIDE_FROM_ABI __movable_box& operator=(__movable_box const&) + __movable_box& operator=(__movable_box const&) requires copyable<_Tp> = default; - _LIBCPP_HIDE_FROM_ABI __movable_box& operator=(__movable_box&&) + __movable_box& operator=(__movable_box&&) requires movable<_Tp> = default; // Implementation of assignment operators in case we perform optimization (2) - _LIBCPP_HIDE_FROM_ABI constexpr __movable_box& operator=(__movable_box const& __other) noexcept { + constexpr __movable_box& operator=(__movable_box const& __other) noexcept { static_assert(is_nothrow_copy_constructible_v<_Tp>); static_assert(!__can_use_no_unique_address<_Tp>); if (this != std::addressof(__other)) { @@ -218,7 +213,7 @@ class __movable_box<_Tp> { return *this; } - _LIBCPP_HIDE_FROM_ABI constexpr __movable_box& operator=(__movable_box&& __other) noexcept { + constexpr __movable_box& operator=(__movable_box&& __other) noexcept { static_assert(is_nothrow_move_constructible_v<_Tp>); static_assert(!__can_use_no_unique_address<_Tp>); if (this != std::addressof(__other)) { @@ -228,13 +223,13 @@ class __movable_box<_Tp> { return *this; } - _LIBCPP_HIDE_FROM_ABI constexpr _Tp const& operator*() const noexcept { return __holder_.__val_; } - _LIBCPP_HIDE_FROM_ABI constexpr _Tp& operator*() noexcept { return __holder_.__val_; } + constexpr _Tp const& operator*() const noexcept { return __holder_.__val_; } + constexpr _Tp& operator*() noexcept { return __holder_.__val_; } - _LIBCPP_HIDE_FROM_ABI constexpr const _Tp* operator->() const noexcept { return std::addressof(__holder_.__val_); } - _LIBCPP_HIDE_FROM_ABI constexpr _Tp* operator->() noexcept { return std::addressof(__holder_.__val_); } + constexpr const _Tp* operator->() const noexcept { return std::addressof(__holder_.__val_); } + constexpr _Tp* operator->() noexcept { return std::addressof(__holder_.__val_); } - _LIBCPP_HIDE_FROM_ABI constexpr bool __has_value() const noexcept { return true; } + constexpr bool __has_value() const noexcept { return true; } }; } // namespace ranges diff --git a/libcxx/include/__ranges/non_propagating_cache.h b/libcxx/include/__ranges/non_propagating_cache.h index beae13a98e9e3..8897ac8d72e5a 100644 --- a/libcxx/include/__ranges/non_propagating_cache.h +++ b/libcxx/include/__ranges/non_propagating_cache.h @@ -44,51 +44,48 @@ class __non_propagating_cache { // constructing the contained type from an iterator. struct __wrapper { template - _LIBCPP_HIDE_FROM_ABI constexpr explicit __wrapper(__forward_tag, _Args&&... __args) - : __t_(std::forward<_Args>(__args)...) {} + constexpr explicit __wrapper(__forward_tag, _Args&&... __args) : __t_(std::forward<_Args>(__args)...) {} template - _LIBCPP_HIDE_FROM_ABI constexpr explicit __wrapper(__from_tag, _Fn const& __f) : __t_(__f()) {} + constexpr explicit __wrapper(__from_tag, _Fn const& __f) : __t_(__f()) {} _Tp __t_; }; optional<__wrapper> __value_ = nullopt; public: - _LIBCPP_HIDE_FROM_ABI __non_propagating_cache() = default; + __non_propagating_cache() = default; - _LIBCPP_HIDE_FROM_ABI constexpr __non_propagating_cache(__non_propagating_cache const&) noexcept - : __value_(nullopt) {} + constexpr __non_propagating_cache(__non_propagating_cache const&) noexcept : __value_(nullopt) {} - _LIBCPP_HIDE_FROM_ABI constexpr __non_propagating_cache(__non_propagating_cache&& __other) noexcept - : __value_(nullopt) { + constexpr __non_propagating_cache(__non_propagating_cache&& __other) noexcept : __value_(nullopt) { __other.__value_.reset(); } - _LIBCPP_HIDE_FROM_ABI constexpr __non_propagating_cache& operator=(__non_propagating_cache const& __other) noexcept { + constexpr __non_propagating_cache& operator=(__non_propagating_cache const& __other) noexcept { if (this != std::addressof(__other)) { __value_.reset(); } return *this; } - _LIBCPP_HIDE_FROM_ABI constexpr __non_propagating_cache& operator=(__non_propagating_cache&& __other) noexcept { + constexpr __non_propagating_cache& operator=(__non_propagating_cache&& __other) noexcept { __value_.reset(); __other.__value_.reset(); return *this; } - _LIBCPP_HIDE_FROM_ABI constexpr _Tp& operator*() { return __value_->__t_; } - _LIBCPP_HIDE_FROM_ABI constexpr _Tp const& operator*() const { return __value_->__t_; } + constexpr _Tp& operator*() { return __value_->__t_; } + constexpr _Tp const& operator*() const { return __value_->__t_; } - _LIBCPP_HIDE_FROM_ABI constexpr bool __has_value() const { return __value_.has_value(); } + constexpr bool __has_value() const { return __value_.has_value(); } template - _LIBCPP_HIDE_FROM_ABI constexpr _Tp& __emplace_from(_Fn const& __f) { + constexpr _Tp& __emplace_from(_Fn const& __f) { return __value_.emplace(__from_tag{}, __f).__t_; } template - _LIBCPP_HIDE_FROM_ABI constexpr _Tp& __emplace(_Args&&... __args) { + constexpr _Tp& __emplace(_Args&&... __args) { return __value_.emplace(__forward_tag{}, std::forward<_Args>(__args)...).__t_; } }; diff --git a/libcxx/include/__ranges/owning_view.h b/libcxx/include/__ranges/owning_view.h index 254bdb4329119..9c7294bc6d94a 100644 --- a/libcxx/include/__ranges/owning_view.h +++ b/libcxx/include/__ranges/owning_view.h @@ -41,60 +41,60 @@ class owning_view : public view_interface> { _Rp __r_ = _Rp(); public: - _LIBCPP_HIDE_FROM_ABI owning_view() + owning_view() requires default_initializable<_Rp> = default; - _LIBCPP_HIDE_FROM_ABI constexpr owning_view(_Rp&& __r) : __r_(std::move(__r)) {} + constexpr owning_view(_Rp&& __r) : __r_(std::move(__r)) {} - _LIBCPP_HIDE_FROM_ABI owning_view(owning_view&&) = default; - _LIBCPP_HIDE_FROM_ABI owning_view& operator=(owning_view&&) = default; + 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 std::move(__r_); } - _LIBCPP_HIDE_FROM_ABI constexpr const _Rp&& base() const&& noexcept { return std::move(__r_); } + constexpr _Rp& base() & noexcept { return __r_; } + constexpr const _Rp& base() const& noexcept { return __r_; } + constexpr _Rp&& base() && noexcept { return std::move(__r_); } + constexpr const _Rp&& base() const&& noexcept { return std::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 + constexpr iterator_t<_Rp> begin() { return ranges::begin(__r_); } + constexpr sentinel_t<_Rp> end() { return ranges::end(__r_); } + constexpr auto begin() const requires range { return ranges::begin(__r_); } - _LIBCPP_HIDE_FROM_ABI constexpr auto end() const + constexpr auto end() const requires range { return ranges::end(__r_); } - _LIBCPP_HIDE_FROM_ABI constexpr bool empty() + constexpr bool empty() requires requires { ranges::empty(__r_); } { return ranges::empty(__r_); } - _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const + constexpr bool empty() const requires requires { ranges::empty(__r_); } { return ranges::empty(__r_); } - _LIBCPP_HIDE_FROM_ABI constexpr auto size() + constexpr auto size() requires sized_range<_Rp> { return ranges::size(__r_); } - _LIBCPP_HIDE_FROM_ABI constexpr auto size() const + constexpr auto size() const requires sized_range { return ranges::size(__r_); } - _LIBCPP_HIDE_FROM_ABI constexpr auto data() + constexpr auto data() requires contiguous_range<_Rp> { return ranges::data(__r_); } - _LIBCPP_HIDE_FROM_ABI constexpr auto data() const + constexpr auto data() const requires contiguous_range { return ranges::data(__r_); diff --git a/libcxx/include/__ranges/range_adaptor.h b/libcxx/include/__ranges/range_adaptor.h index 4bcb53e1a5846..d9c0dee0adc0e 100644 --- a/libcxx/include/__ranges/range_adaptor.h +++ b/libcxx/include/__ranges/range_adaptor.h @@ -53,7 +53,7 @@ struct __range_adaptor_closure {}; // i.e. something that can be called via the `x | f` notation. template struct __pipeable : _Fn, __range_adaptor_closure<__pipeable<_Fn>> { - _LIBCPP_HIDE_FROM_ABI constexpr explicit __pipeable(_Fn&& __f) : _Fn(std::move(__f)) {} + constexpr explicit __pipeable(_Fn&& __f) : _Fn(std::move(__f)) {} }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(__pipeable); @@ -69,14 +69,14 @@ concept _RangeAdaptorClosure = !ranges::range> && requires { template requires invocable<_Closure, _Range> -[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) +[[nodiscard]] constexpr decltype(auto) operator|(_Range&& __range, _Closure&& __closure) noexcept(is_nothrow_invocable_v<_Closure, _Range>) { return std::invoke(std::forward<_Closure>(__closure), std::forward<_Range>(__range)); } template <_RangeAdaptorClosure _Closure, _RangeAdaptorClosure _OtherClosure> requires constructible_from, _Closure> && constructible_from, _OtherClosure> -[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator|(_Closure&& __c1, _OtherClosure&& __c2) noexcept( +[[nodiscard]] constexpr auto operator|(_Closure&& __c1, _OtherClosure&& __c2) noexcept( is_nothrow_constructible_v, _Closure> && is_nothrow_constructible_v, _OtherClosure>) { return __pipeable(std::__compose(std::forward<_OtherClosure>(__c2), std::forward<_Closure>(__c1))); diff --git a/libcxx/include/__ranges/rbegin.h b/libcxx/include/__ranges/rbegin.h index 12e739e1a2b85..c2a45aa16c389 100644 --- a/libcxx/include/__ranges/rbegin.h +++ b/libcxx/include/__ranges/rbegin.h @@ -58,21 +58,19 @@ concept __can_reverse = struct __fn { template requires __member_rbegin<_Tp> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const - noexcept(noexcept(_LIBCPP_AUTO_CAST(__t.rbegin()))) { + [[nodiscard]] constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(_LIBCPP_AUTO_CAST(__t.rbegin()))) { return _LIBCPP_AUTO_CAST(__t.rbegin()); } template requires __unqualified_rbegin<_Tp> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const - noexcept(noexcept(_LIBCPP_AUTO_CAST(rbegin(__t)))) { + [[nodiscard]] constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(_LIBCPP_AUTO_CAST(rbegin(__t)))) { return _LIBCPP_AUTO_CAST(rbegin(__t)); } template requires __can_reverse<_Tp> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(ranges::end(__t))) { + [[nodiscard]] constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(ranges::end(__t))) { return std::make_reverse_iterator(ranges::end(__t)); } @@ -92,7 +90,7 @@ namespace __crbegin { struct __fn { template requires is_lvalue_reference_v<_Tp&&> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const + [[nodiscard]] constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(ranges::rbegin(static_cast&>(__t)))) -> decltype(ranges::rbegin(static_cast&>(__t))) { return ranges::rbegin(static_cast&>(__t)); @@ -100,7 +98,7 @@ struct __fn { template requires is_rvalue_reference_v<_Tp&&> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const + [[nodiscard]] constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(ranges::rbegin(static_cast(__t)))) -> decltype(ranges::rbegin(static_cast(__t))) { return ranges::rbegin(static_cast(__t)); diff --git a/libcxx/include/__ranges/ref_view.h b/libcxx/include/__ranges/ref_view.h index 5329d778dd30d..a4b2fef91ace3 100644 --- a/libcxx/include/__ranges/ref_view.h +++ b/libcxx/include/__ranges/ref_view.h @@ -48,27 +48,26 @@ class ref_view : public view_interface> { public: template requires __different_from<_Tp, ref_view> && convertible_to<_Tp, _Range&> && requires { __fun(std::declval<_Tp>()); } - _LIBCPP_HIDE_FROM_ABI constexpr ref_view(_Tp&& __t) - : __range_(std::addressof(static_cast<_Range&>(std::forward<_Tp>(__t)))) {} + constexpr ref_view(_Tp&& __t) : __range_(std::addressof(static_cast<_Range&>(std::forward<_Tp>(__t)))) {} - _LIBCPP_HIDE_FROM_ABI constexpr _Range& base() const { return *__range_; } + constexpr _Range& base() const { return *__range_; } - _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Range> begin() const { return ranges::begin(*__range_); } - _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Range> end() const { return ranges::end(*__range_); } + constexpr iterator_t<_Range> begin() const { return ranges::begin(*__range_); } + constexpr sentinel_t<_Range> end() const { return ranges::end(*__range_); } - _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const + constexpr bool empty() const requires requires { ranges::empty(*__range_); } { return ranges::empty(*__range_); } - _LIBCPP_HIDE_FROM_ABI constexpr auto size() const + constexpr auto size() const requires sized_range<_Range> { return ranges::size(*__range_); } - _LIBCPP_HIDE_FROM_ABI constexpr auto data() const + constexpr auto data() const requires contiguous_range<_Range> { return ranges::data(*__range_); diff --git a/libcxx/include/__ranges/rend.h b/libcxx/include/__ranges/rend.h index 02b4c5999a7eb..9910df2dd0db0 100644 --- a/libcxx/include/__ranges/rend.h +++ b/libcxx/include/__ranges/rend.h @@ -61,22 +61,19 @@ class __fn { public: template requires __member_rend<_Tp> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const - noexcept(noexcept(_LIBCPP_AUTO_CAST(__t.rend()))) { + [[nodiscard]] constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(_LIBCPP_AUTO_CAST(__t.rend()))) { return _LIBCPP_AUTO_CAST(__t.rend()); } template requires __unqualified_rend<_Tp> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const - noexcept(noexcept(_LIBCPP_AUTO_CAST(rend(__t)))) { + [[nodiscard]] constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(_LIBCPP_AUTO_CAST(rend(__t)))) { return _LIBCPP_AUTO_CAST(rend(__t)); } template requires __can_reverse<_Tp> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const - noexcept(noexcept(ranges::begin(__t))) { + [[nodiscard]] constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(ranges::begin(__t))) { return std::make_reverse_iterator(ranges::begin(__t)); } @@ -96,7 +93,7 @@ namespace __crend { struct __fn { template requires is_lvalue_reference_v<_Tp&&> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const + [[nodiscard]] constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(ranges::rend(static_cast&>(__t)))) -> decltype(ranges::rend(static_cast&>(__t))) { return ranges::rend(static_cast&>(__t)); @@ -104,8 +101,9 @@ struct __fn { template requires is_rvalue_reference_v<_Tp&&> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const noexcept( - noexcept(ranges::rend(static_cast(__t)))) -> decltype(ranges::rend(static_cast(__t))) { + [[nodiscard]] constexpr auto operator()(_Tp&& __t) const + noexcept(noexcept(ranges::rend(static_cast(__t)))) + -> decltype(ranges::rend(static_cast(__t))) { return ranges::rend(static_cast(__t)); } }; diff --git a/libcxx/include/__ranges/repeat_view.h b/libcxx/include/__ranges/repeat_view.h index 56b09701c8090..d59accd6621b6 100644 --- a/libcxx/include/__ranges/repeat_view.h +++ b/libcxx/include/__ranges/repeat_view.h @@ -80,18 +80,18 @@ class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS repeat_view : public view_interface = default; - _LIBCPP_HIDE_FROM_ABI constexpr explicit repeat_view(const _Tp& __value, _Bound __bound_sentinel = _Bound()) + constexpr explicit repeat_view(const _Tp& __value, _Bound __bound_sentinel = _Bound()) requires copy_constructible<_Tp> : __value_(in_place, __value), __bound_(__bound_sentinel) { if constexpr (!same_as<_Bound, unreachable_sentinel_t>) _LIBCPP_ASSERT_UNCATEGORIZED(__bound_ >= 0, "The value of bound must be greater than or equal to 0"); } - _LIBCPP_HIDE_FROM_ABI constexpr explicit repeat_view(_Tp&& __value, _Bound __bound_sentinel = _Bound()) + constexpr explicit repeat_view(_Tp&& __value, _Bound __bound_sentinel = _Bound()) : __value_(in_place, std::move(__value)), __bound_(__bound_sentinel) { if constexpr (!same_as<_Bound, unreachable_sentinel_t>) _LIBCPP_ASSERT_UNCATEGORIZED(__bound_ >= 0, "The value of bound must be greater than or equal to 0"); @@ -99,7 +99,7 @@ class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS repeat_view : public view_interface requires(constructible_from<_Tp, _TpArgs...> && constructible_from<_Bound, _BoundArgs...>) - _LIBCPP_HIDE_FROM_ABI constexpr explicit repeat_view( + constexpr explicit repeat_view( piecewise_construct_t, tuple<_TpArgs...> __value_args, tuple<_BoundArgs...> __bound_args = tuple<>{}) : __value_(in_place, std::make_from_tuple<_Tp>(std::move(__value_args))), __bound_(std::make_from_tuple<_Bound>(std::move(__bound_args))) { @@ -108,17 +108,17 @@ class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS repeat_view : public view_interface= 0, "The behavior is undefined if Bound is not unreachable_sentinel_t and bound is negative"); } - _LIBCPP_HIDE_FROM_ABI constexpr __iterator begin() const { return __iterator(std::addressof(*__value_)); } + constexpr __iterator begin() const { return __iterator(std::addressof(*__value_)); } - _LIBCPP_HIDE_FROM_ABI constexpr __iterator end() const + constexpr __iterator end() const requires(!same_as<_Bound, unreachable_sentinel_t>) { return __iterator(std::addressof(*__value_), __bound_); } - _LIBCPP_HIDE_FROM_ABI constexpr unreachable_sentinel_t end() const noexcept { return unreachable_sentinel; } + constexpr unreachable_sentinel_t end() const noexcept { return unreachable_sentinel; } - _LIBCPP_HIDE_FROM_ABI constexpr auto size() const + constexpr auto size() const requires(!same_as<_Bound, unreachable_sentinel_t>) { return std::__to_unsigned_like(__bound_); @@ -141,7 +141,7 @@ class repeat_view<_Tp, _Bound>::__iterator { using _IndexT _LIBCPP_NODEBUG = conditional_t, ptrdiff_t, _Bound>; - _LIBCPP_HIDE_FROM_ABI constexpr explicit __iterator(const _Tp* __value, _IndexT __bound_sentinel = _IndexT()) + constexpr explicit __iterator(const _Tp* __value, _IndexT __bound_sentinel = _IndexT()) : __value_(__value), __current_(__bound_sentinel) {} public: @@ -150,74 +150,74 @@ class repeat_view<_Tp, _Bound>::__iterator { using value_type = _Tp; using difference_type = __repeat_view_iterator_difference_t<_IndexT>; - _LIBCPP_HIDE_FROM_ABI __iterator() = default; + __iterator() = default; - _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& operator*() const noexcept { return *__value_; } + constexpr const _Tp& operator*() const noexcept { return *__value_; } - _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() { + constexpr __iterator& operator++() { ++__current_; return *this; } - _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int) { + constexpr __iterator operator++(int) { auto __tmp = *this; ++*this; return __tmp; } - _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator--() { + constexpr __iterator& operator--() { if constexpr (!same_as<_Bound, unreachable_sentinel_t>) _LIBCPP_ASSERT_UNCATEGORIZED(__current_ > 0, "The value of bound must be greater than or equal to 0"); --__current_; return *this; } - _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator--(int) { + constexpr __iterator operator--(int) { auto __tmp = *this; --*this; return __tmp; } - _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator+=(difference_type __n) { + constexpr __iterator& operator+=(difference_type __n) { if constexpr (!same_as<_Bound, unreachable_sentinel_t>) _LIBCPP_ASSERT_UNCATEGORIZED(__current_ + __n >= 0, "The value of bound must be greater than or equal to 0"); __current_ += __n; return *this; } - _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator-=(difference_type __n) { + constexpr __iterator& operator-=(difference_type __n) { if constexpr (!same_as<_Bound, unreachable_sentinel_t>) _LIBCPP_ASSERT_UNCATEGORIZED(__current_ - __n >= 0, "The value of bound must be greater than or equal to 0"); __current_ -= __n; return *this; } - _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& operator[](difference_type __n) const noexcept { return *(*this + __n); } + constexpr const _Tp& operator[](difference_type __n) const noexcept { return *(*this + __n); } - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __iterator& __y) { + friend constexpr bool operator==(const __iterator& __x, const __iterator& __y) { return __x.__current_ == __y.__current_; } - _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator<=>(const __iterator& __x, const __iterator& __y) { + friend constexpr auto operator<=>(const __iterator& __x, const __iterator& __y) { return __x.__current_ <=> __y.__current_; } - _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(__iterator __i, difference_type __n) { + friend constexpr __iterator operator+(__iterator __i, difference_type __n) { __i += __n; return __i; } - _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, __iterator __i) { + friend constexpr __iterator operator+(difference_type __n, __iterator __i) { __i += __n; return __i; } - _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(__iterator __i, difference_type __n) { + friend constexpr __iterator operator-(__iterator __i, difference_type __n) { __i -= __n; return __i; } - _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y) { + friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y) { return static_cast(__x.__current_) - static_cast(__y.__current_); } @@ -231,13 +231,13 @@ namespace views { namespace __repeat { struct __fn { template - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Tp&& __value) + [[nodiscard]] static constexpr auto operator()(_Tp&& __value) noexcept(noexcept(ranges::repeat_view>(std::forward<_Tp>(__value)))) -> decltype( ranges::repeat_view>(std::forward<_Tp>(__value))) { return ranges::repeat_view>(std::forward<_Tp>(__value)); } template - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Tp&& __value, _Bound&& __bound_sentinel) + [[nodiscard]] static constexpr auto operator()(_Tp&& __value, _Bound&& __bound_sentinel) noexcept(noexcept(ranges::repeat_view(std::forward<_Tp>(__value), std::forward<_Bound>(__bound_sentinel)))) -> decltype( ranges::repeat_view(std::forward<_Tp>(__value), std::forward<_Bound>(__bound_sentinel))) { return ranges::repeat_view(std::forward<_Tp>(__value), std::forward<_Bound>(__bound_sentinel)); } diff --git a/libcxx/include/__ranges/reverse_view.h b/libcxx/include/__ranges/reverse_view.h index c36ba77dd8f6d..23490fd9cd0bf 100644 --- a/libcxx/include/__ranges/reverse_view.h +++ b/libcxx/include/__ranges/reverse_view.h @@ -53,21 +53,21 @@ class reverse_view : public view_interface> { _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View(); public: - _LIBCPP_HIDE_FROM_ABI reverse_view() + reverse_view() requires default_initializable<_View> = default; - _LIBCPP_HIDE_FROM_ABI constexpr explicit reverse_view(_View __view) : __base_(std::move(__view)) {} + constexpr explicit reverse_view(_View __view) : __base_(std::move(__view)) {} - _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& + constexpr _View base() const& requires copy_constructible<_View> { return __base_; } - _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); } + constexpr _View base() && { return std::move(__base_); } - _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator> begin() { + constexpr reverse_iterator> begin() { if constexpr (_UseCache) if (__cached_begin_.__has_value()) return *__cached_begin_; @@ -78,35 +78,33 @@ class reverse_view : public view_interface> { return __tmp; } - _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator> begin() + constexpr reverse_iterator> begin() requires common_range<_View> { return std::make_reverse_iterator(ranges::end(__base_)); } - _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const + constexpr auto begin() const requires common_range { return std::make_reverse_iterator(ranges::end(__base_)); } - _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator> end() { - return std::make_reverse_iterator(ranges::begin(__base_)); - } + constexpr reverse_iterator> end() { return std::make_reverse_iterator(ranges::begin(__base_)); } - _LIBCPP_HIDE_FROM_ABI constexpr auto end() const + constexpr auto end() const requires common_range { return std::make_reverse_iterator(ranges::begin(__base_)); } - _LIBCPP_HIDE_FROM_ABI constexpr auto size() + constexpr auto size() requires sized_range<_View> { return ranges::size(__base_); } - _LIBCPP_HIDE_FROM_ABI constexpr auto size() const + constexpr auto size() const requires sized_range { return ranges::size(__base_); @@ -156,7 +154,7 @@ struct __unwrapped_reverse_subrange, reverse_it struct __fn : __range_adaptor_closure<__fn> { template requires __is_reverse_view> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const + [[nodiscard]] constexpr auto operator()(_Range&& __range) const noexcept(noexcept(std::forward<_Range>(__range).base())) -> decltype(std::forward<_Range>(__range).base()) { return std::forward<_Range>(__range).base(); } @@ -164,7 +162,7 @@ struct __fn : __range_adaptor_closure<__fn> { template >::type> requires __is_sized_reverse_subrange> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const + [[nodiscard]] constexpr auto operator()(_Range&& __range) const noexcept(noexcept(_UnwrappedSubrange(__range.end().base(), __range.begin().base(), __range.size()))) -> decltype(_UnwrappedSubrange(__range.end().base(), __range.begin().base(), __range.size())) { return _UnwrappedSubrange(__range.end().base(), __range.begin().base(), __range.size()); @@ -173,7 +171,7 @@ struct __fn : __range_adaptor_closure<__fn> { template >::type> requires __is_unsized_reverse_subrange> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const + [[nodiscard]] constexpr auto operator()(_Range&& __range) const noexcept(noexcept(_UnwrappedSubrange(__range.end().base(), __range.begin().base()))) -> decltype(_UnwrappedSubrange(__range.end().base(), __range.begin().base())) { return _UnwrappedSubrange(__range.end().base(), __range.begin().base()); @@ -182,8 +180,9 @@ struct __fn : __range_adaptor_closure<__fn> { template requires(!__is_reverse_view> && !__is_sized_reverse_subrange> && !__is_unsized_reverse_subrange>) - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const noexcept(noexcept(reverse_view{ - std::forward<_Range>(__range)})) -> decltype(reverse_view{std::forward<_Range>(__range)}) { + [[nodiscard]] constexpr auto operator()(_Range&& __range) const + noexcept(noexcept(reverse_view{std::forward<_Range>(__range)})) + -> decltype(reverse_view{std::forward<_Range>(__range)}) { return reverse_view{std::forward<_Range>(__range)}; } }; diff --git a/libcxx/include/__ranges/single_view.h b/libcxx/include/__ranges/single_view.h index 955578b99cf58..79e6d7adf3417 100644 --- a/libcxx/include/__ranges/single_view.h +++ b/libcxx/include/__ranges/single_view.h @@ -45,39 +45,38 @@ class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS single_view : public view_interface __value_; public: - _LIBCPP_HIDE_FROM_ABI single_view() + single_view() requires default_initializable<_Tp> = default; - _LIBCPP_HIDE_FROM_ABI constexpr explicit single_view(const _Tp& __t) + constexpr explicit single_view(const _Tp& __t) # if _LIBCPP_STD_VER >= 23 requires copy_constructible<_Tp> # endif : __value_(in_place, __t) { } - _LIBCPP_HIDE_FROM_ABI constexpr explicit single_view(_Tp&& __t) : __value_(in_place, std::move(__t)) {} + constexpr explicit single_view(_Tp&& __t) : __value_(in_place, std::move(__t)) {} template requires constructible_from<_Tp, _Args...> - _LIBCPP_HIDE_FROM_ABI constexpr explicit single_view(in_place_t, _Args&&... __args) - : __value_{in_place, std::forward<_Args>(__args)...} {} + constexpr explicit single_view(in_place_t, _Args&&... __args) : __value_{in_place, std::forward<_Args>(__args)...} {} - _LIBCPP_HIDE_FROM_ABI constexpr _Tp* begin() noexcept { return data(); } + constexpr _Tp* begin() noexcept { return data(); } - _LIBCPP_HIDE_FROM_ABI constexpr const _Tp* begin() const noexcept { return data(); } + constexpr const _Tp* begin() const noexcept { return data(); } - _LIBCPP_HIDE_FROM_ABI constexpr _Tp* end() noexcept { return data() + 1; } + constexpr _Tp* end() noexcept { return data() + 1; } - _LIBCPP_HIDE_FROM_ABI constexpr const _Tp* end() const noexcept { return data() + 1; } + constexpr const _Tp* end() const noexcept { return data() + 1; } - _LIBCPP_HIDE_FROM_ABI static constexpr bool empty() noexcept { return false; } + static constexpr bool empty() noexcept { return false; } - _LIBCPP_HIDE_FROM_ABI static constexpr size_t size() noexcept { return 1; } + static constexpr size_t size() noexcept { return 1; } - _LIBCPP_HIDE_FROM_ABI constexpr _Tp* data() noexcept { return __value_.operator->(); } + constexpr _Tp* data() noexcept { return __value_.operator->(); } - _LIBCPP_HIDE_FROM_ABI constexpr const _Tp* data() const noexcept { return __value_.operator->(); } + constexpr const _Tp* data() const noexcept { return __value_.operator->(); } }; template @@ -88,7 +87,7 @@ namespace __single_view { struct __fn : __range_adaptor_closure<__fn> { template - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const + [[nodiscard]] constexpr auto operator()(_Range&& __range) const noexcept(noexcept(single_view>(std::forward<_Range>(__range)))) -> decltype(single_view>(std::forward<_Range>(__range))) { return single_view>(std::forward<_Range>(__range)); diff --git a/libcxx/include/__ranges/size.h b/libcxx/include/__ranges/size.h index 5da3a6ff268e8..65ce755066a60 100644 --- a/libcxx/include/__ranges/size.h +++ b/libcxx/include/__ranges/size.h @@ -68,33 +68,33 @@ concept __difference = struct __fn { // `[range.prim.size]`: the array case (for rvalues). template - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr size_t operator()(_Tp (&&)[_Sz]) const noexcept { + [[nodiscard]] constexpr size_t operator()(_Tp (&&)[_Sz]) const noexcept { return _Sz; } // `[range.prim.size]`: the array case (for lvalues). template - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr size_t operator()(_Tp (&)[_Sz]) const noexcept { + [[nodiscard]] constexpr size_t operator()(_Tp (&)[_Sz]) const noexcept { return _Sz; } // `[range.prim.size]`: `auto(t.size())` is a valid expression. template <__member_size _Tp> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __integer_like auto operator()(_Tp&& __t) const + [[nodiscard]] constexpr __integer_like auto operator()(_Tp&& __t) const noexcept(noexcept(_LIBCPP_AUTO_CAST(__t.size()))) { return _LIBCPP_AUTO_CAST(__t.size()); } // `[range.prim.size]`: `auto(size(t))` is a valid expression. template <__unqualified_size _Tp> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __integer_like auto operator()(_Tp&& __t) const + [[nodiscard]] constexpr __integer_like auto operator()(_Tp&& __t) const noexcept(noexcept(_LIBCPP_AUTO_CAST(size(__t)))) { return _LIBCPP_AUTO_CAST(size(__t)); } // [range.prim.size]: the `to-unsigned-like` case. template <__difference _Tp> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const + [[nodiscard]] constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(std::__to_unsigned_like(ranges::end(__t) - ranges::begin(__t)))) -> decltype(std::__to_unsigned_like(ranges::end(__t) - ranges::begin(__t))) { return std::__to_unsigned_like(ranges::end(__t) - ranges::begin(__t)); diff --git a/libcxx/include/__ranges/split_view.h b/libcxx/include/__ranges/split_view.h index 2ec908ba4070e..a4ba39ea5ee0a 100644 --- a/libcxx/include/__ranges/split_view.h +++ b/libcxx/include/__ranges/split_view.h @@ -74,36 +74,35 @@ class split_view : public view_interface> { } public: - _LIBCPP_HIDE_FROM_ABI split_view() + split_view() requires default_initializable<_View> && default_initializable<_Pattern> = default; - _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 split_view(_View __base, _Pattern __pattern) + constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 split_view(_View __base, _Pattern __pattern) : __base_(std::move(__base)), __pattern_(std::move((__pattern))) {} template requires constructible_from<_View, views::all_t<_Range>> && constructible_from<_Pattern, single_view>> - _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 - split_view(_Range&& __range, range_value_t<_Range> __elem) + constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 split_view(_Range&& __range, range_value_t<_Range> __elem) : __base_(views::all(std::forward<_Range>(__range))), __pattern_(views::single(std::move(__elem))) {} - _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& + constexpr _View base() const& requires copy_constructible<_View> { return __base_; } - _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); } + constexpr _View base() && { return std::move(__base_); } - _LIBCPP_HIDE_FROM_ABI constexpr __iterator begin() { + constexpr __iterator begin() { if (!__cached_begin_.__has_value()) { __cached_begin_.__emplace(__find_next(ranges::begin(__base_))); } return {*this, ranges::begin(__base_), *__cached_begin_}; } - _LIBCPP_HIDE_FROM_ABI constexpr auto end() { + constexpr auto end() { if constexpr (common_range<_View>) { return __iterator{*this, ranges::end(__base_), {}}; } else { @@ -136,17 +135,17 @@ struct split_view<_View, _Pattern>::__iterator { using value_type = subrange>; using difference_type = range_difference_t<_View>; - _LIBCPP_HIDE_FROM_ABI __iterator() = default; + __iterator() = default; - _LIBCPP_HIDE_FROM_ABI constexpr __iterator( + constexpr __iterator( split_view<_View, _Pattern>& __parent, iterator_t<_View> __current, subrange> __next) : __parent_(std::addressof(__parent)), __cur_(std::move(__current)), __next_(std::move(__next)) {} - _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_View> base() const { return __cur_; } + constexpr iterator_t<_View> base() const { return __cur_; } - _LIBCPP_HIDE_FROM_ABI constexpr value_type operator*() const { return {__cur_, __next_.begin()}; } + constexpr value_type operator*() const { return {__cur_, __next_.begin()}; } - _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() { + constexpr __iterator& operator++() { __cur_ = __next_.begin(); if (__cur_ != ranges::end(__parent_->__base_)) { __cur_ = __next_.end(); @@ -162,13 +161,13 @@ struct split_view<_View, _Pattern>::__iterator { return *this; } - _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int) { + constexpr __iterator operator++(int) { auto __tmp = *this; ++*this; return __tmp; } - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __iterator& __y) { + friend constexpr bool operator==(const __iterator& __x, const __iterator& __y) { return __x.__cur_ == __y.__cur_ && __x.__trailing_empty_ == __y.__trailing_empty_; } }; @@ -180,19 +179,16 @@ struct split_view<_View, _Pattern>::__sentinel { private: _LIBCPP_NO_UNIQUE_ADDRESS sentinel_t<_View> __end_ = sentinel_t<_View>(); - _LIBCPP_HIDE_FROM_ABI static constexpr bool __equals(const __iterator& __x, const __sentinel& __y) { + static constexpr bool __equals(const __iterator& __x, const __sentinel& __y) { return __x.__cur_ == __y.__end_ && !__x.__trailing_empty_; } public: - _LIBCPP_HIDE_FROM_ABI __sentinel() = default; + __sentinel() = default; - _LIBCPP_HIDE_FROM_ABI constexpr explicit __sentinel(split_view<_View, _Pattern>& __parent) - : __end_(ranges::end(__parent.__base_)) {} + constexpr explicit __sentinel(split_view<_View, _Pattern>& __parent) : __end_(ranges::end(__parent.__base_)) {} - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __sentinel& __y) { - return __equals(__x, __y); - } + friend constexpr bool operator==(const __iterator& __x, const __sentinel& __y) { return __equals(__x, __y); } }; namespace views { @@ -200,8 +196,7 @@ namespace __split_view { struct __fn { // clang-format off template - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI - constexpr auto operator()(_Range&& __range, _Pattern&& __pattern) const + [[nodiscard]] constexpr auto operator()(_Range&& __range, _Pattern&& __pattern) const noexcept(noexcept(split_view(std::forward<_Range>(__range), std::forward<_Pattern>(__pattern)))) -> decltype( split_view(std::forward<_Range>(__range), std::forward<_Pattern>(__pattern))) { return split_view(std::forward<_Range>(__range), std::forward<_Pattern>(__pattern)); } @@ -209,7 +204,7 @@ struct __fn { template requires constructible_from, _Pattern> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Pattern&& __pattern) const + [[nodiscard]] constexpr auto operator()(_Pattern&& __pattern) const noexcept(is_nothrow_constructible_v, _Pattern>) { return __pipeable(std::__bind_back(*this, std::forward<_Pattern>(__pattern))); } diff --git a/libcxx/include/__ranges/subrange.h b/libcxx/include/__ranges/subrange.h index df8766216dbe2..aa6c1c7445bce 100644 --- a/libcxx/include/__ranges/subrange.h +++ b/libcxx/include/__ranges/subrange.h @@ -80,7 +80,7 @@ class subrange : public view_interface> { private: static constexpr bool _MustProvideSizeAtConstruction = !_StoreSize; // just to improve compiler diagnostics struct _Empty { - _LIBCPP_HIDE_FROM_ABI constexpr _Empty(auto) noexcept {} + constexpr _Empty(auto) noexcept {} }; using _Size _LIBCPP_NODEBUG = conditional_t<_StoreSize, make_unsigned_t>, _Empty>; _LIBCPP_NO_UNIQUE_ADDRESS _Iter __begin_ = _Iter(); @@ -88,15 +88,15 @@ class subrange : public view_interface> { _LIBCPP_NO_UNIQUE_ADDRESS _Size __size_ = 0; public: - _LIBCPP_HIDE_FROM_ABI subrange() + subrange() requires default_initializable<_Iter> = default; - _LIBCPP_HIDE_FROM_ABI constexpr subrange(__convertible_to_non_slicing<_Iter> auto __iter, _Sent __sent) + constexpr subrange(__convertible_to_non_slicing<_Iter> auto __iter, _Sent __sent) requires _MustProvideSizeAtConstruction : __begin_(std::move(__iter)), __end_(std::move(__sent)) {} - _LIBCPP_HIDE_FROM_ABI constexpr subrange( + constexpr subrange( __convertible_to_non_slicing<_Iter> auto __iter, _Sent __sent, make_unsigned_t> __n) requires(_Kind == subrange_kind::sized) : __begin_(std::move(__iter)), __end_(std::move(__sent)), __size_(__n) { @@ -108,46 +108,46 @@ class subrange : public view_interface> { template <__different_from _Range> requires borrowed_range<_Range> && __convertible_to_non_slicing, _Iter> && convertible_to, _Sent> - _LIBCPP_HIDE_FROM_ABI constexpr subrange(_Range&& __range) + constexpr subrange(_Range&& __range) requires(!_StoreSize) : subrange(ranges::begin(__range), ranges::end(__range)) {} template <__different_from _Range> requires borrowed_range<_Range> && __convertible_to_non_slicing, _Iter> && convertible_to, _Sent> - _LIBCPP_HIDE_FROM_ABI constexpr subrange(_Range&& __range) + constexpr subrange(_Range&& __range) requires _StoreSize && sized_range<_Range> : subrange(__range, ranges::size(__range)) {} template requires __convertible_to_non_slicing, _Iter> && convertible_to, _Sent> - _LIBCPP_HIDE_FROM_ABI constexpr subrange(_Range&& __range, make_unsigned_t> __n) + constexpr subrange(_Range&& __range, make_unsigned_t> __n) requires(_Kind == subrange_kind::sized) : subrange(ranges::begin(__range), ranges::end(__range), __n) {} template <__pair_like_convertible_from _Pair> - _LIBCPP_HIDE_FROM_ABI constexpr operator _Pair() const { + constexpr operator _Pair() const { return _Pair(__begin_, __end_); } - _LIBCPP_HIDE_FROM_ABI constexpr _Iter begin() const + constexpr _Iter begin() const requires copyable<_Iter> { return __begin_; } - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Iter begin() + [[nodiscard]] constexpr _Iter begin() requires(!copyable<_Iter>) { return std::move(__begin_); } - _LIBCPP_HIDE_FROM_ABI constexpr _Sent end() const { return __end_; } + constexpr _Sent end() const { return __end_; } - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const { return __begin_ == __end_; } + [[nodiscard]] constexpr bool empty() const { return __begin_ == __end_; } - _LIBCPP_HIDE_FROM_ABI constexpr make_unsigned_t> size() const + constexpr make_unsigned_t> size() const requires(_Kind == subrange_kind::sized) { if constexpr (_StoreSize) @@ -156,7 +156,7 @@ class subrange : public view_interface> { return std::__to_unsigned_like(__end_ - __begin_); } - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr subrange next(iter_difference_t<_Iter> __n = 1) const& + [[nodiscard]] constexpr subrange next(iter_difference_t<_Iter> __n = 1) const& requires forward_iterator<_Iter> { auto __tmp = *this; @@ -164,12 +164,12 @@ class subrange : public view_interface> { return __tmp; } - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr subrange next(iter_difference_t<_Iter> __n = 1) && { + [[nodiscard]] constexpr subrange next(iter_difference_t<_Iter> __n = 1) && { advance(__n); return std::move(*this); } - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr subrange prev(iter_difference_t<_Iter> __n = 1) const + [[nodiscard]] constexpr subrange prev(iter_difference_t<_Iter> __n = 1) const requires bidirectional_iterator<_Iter> { auto __tmp = *this; @@ -177,7 +177,7 @@ class subrange : public view_interface> { return __tmp; } - _LIBCPP_HIDE_FROM_ABI constexpr subrange& advance(iter_difference_t<_Iter> __n) { + constexpr subrange& advance(iter_difference_t<_Iter> __n) { if constexpr (bidirectional_iterator<_Iter>) { if (__n < 0) { ranges::advance(__begin_, __n); @@ -201,11 +201,12 @@ template _Sent> subrange(_Iter, _Sent, make_unsigned_t>) -> subrange<_Iter, _Sent, subrange_kind::sized>; template -subrange(_Range&&) -> subrange, - sentinel_t<_Range>, - (sized_range<_Range> || sized_sentinel_for, iterator_t<_Range>>) - ? subrange_kind::sized - : subrange_kind::unsized>; +subrange(_Range&&) + -> subrange, + sentinel_t<_Range>, + (sized_range<_Range> || sized_sentinel_for, iterator_t<_Range>>) + ? subrange_kind::sized + : subrange_kind::unsized>; template subrange(_Range&&, make_unsigned_t>) @@ -213,7 +214,7 @@ subrange(_Range&&, make_unsigned_t>) template requires((_Index == 0 && copyable<_Iter>) || _Index == 1) -_LIBCPP_HIDE_FROM_ABI constexpr auto get(const subrange<_Iter, _Sent, _Kind>& __subrange) { +constexpr auto get(const subrange<_Iter, _Sent, _Kind>& __subrange) { if constexpr (_Index == 0) return __subrange.begin(); else @@ -222,7 +223,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr auto get(const subrange<_Iter, _Sent, _Kind>& __ template requires(_Index < 2) -_LIBCPP_HIDE_FROM_ABI constexpr auto get(subrange<_Iter, _Sent, _Kind>&& __subrange) { +constexpr auto get(subrange<_Iter, _Sent, _Kind>&& __subrange) { if constexpr (_Index == 0) return __subrange.begin(); else diff --git a/libcxx/include/__ranges/take_view.h b/libcxx/include/__ranges/take_view.h index 85723dc5e36b6..0b292a91d6665 100644 --- a/libcxx/include/__ranges/take_view.h +++ b/libcxx/include/__ranges/take_view.h @@ -65,25 +65,24 @@ class take_view : public view_interface> { class __sentinel; public: - _LIBCPP_HIDE_FROM_ABI take_view() + take_view() requires default_initializable<_View> = default; - _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 - take_view(_View __base, range_difference_t<_View> __count) + constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 take_view(_View __base, range_difference_t<_View> __count) : __base_(std::move(__base)), __count_(__count) { _LIBCPP_ASSERT_UNCATEGORIZED(__count >= 0, "count has to be greater than or equal to zero"); } - _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& + constexpr _View base() const& requires copy_constructible<_View> { return __base_; } - _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); } + constexpr _View base() && { return std::move(__base_); } - _LIBCPP_HIDE_FROM_ABI constexpr auto begin() + constexpr auto begin() requires(!__simple_view<_View>) { if constexpr (sized_range<_View>) { @@ -99,7 +98,7 @@ class take_view : public view_interface> { } } - _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const + constexpr auto begin() const requires range { if constexpr (sized_range) { @@ -115,7 +114,7 @@ class take_view : public view_interface> { } } - _LIBCPP_HIDE_FROM_ABI constexpr auto end() + constexpr auto end() requires(!__simple_view<_View>) { if constexpr (sized_range<_View>) { @@ -129,7 +128,7 @@ class take_view : public view_interface> { } } - _LIBCPP_HIDE_FROM_ABI constexpr auto end() const + constexpr auto end() const requires range { if constexpr (sized_range) { @@ -143,14 +142,14 @@ class take_view : public view_interface> { } } - _LIBCPP_HIDE_FROM_ABI constexpr auto size() + constexpr auto size() requires sized_range<_View> { auto __n = ranges::size(__base_); return ranges::min(__n, static_cast(__count_)); } - _LIBCPP_HIDE_FROM_ABI constexpr auto size() const + constexpr auto size() const requires sized_range { auto __n = ranges::size(__base_); @@ -170,23 +169,23 @@ class take_view<_View>::__sentinel { friend class take_view<_View>::__sentinel; public: - _LIBCPP_HIDE_FROM_ABI __sentinel() = default; + __sentinel() = default; - _LIBCPP_HIDE_FROM_ABI constexpr explicit __sentinel(sentinel_t<_Base> __end) : __end_(std::move(__end)) {} + constexpr explicit __sentinel(sentinel_t<_Base> __end) : __end_(std::move(__end)) {} - _LIBCPP_HIDE_FROM_ABI constexpr __sentinel(__sentinel __s) + constexpr __sentinel(__sentinel __s) requires _Const && convertible_to, sentinel_t<_Base>> : __end_(std::move(__s.__end_)) {} - _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Base> base() const { return __end_; } + constexpr sentinel_t<_Base> base() const { return __end_; } - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const _Iter<_Const>& __lhs, const __sentinel& __rhs) { + friend constexpr bool operator==(const _Iter<_Const>& __lhs, const __sentinel& __rhs) { return __lhs.count() == 0 || __lhs.base() == __rhs.__end_; } template requires sentinel_for, iterator_t<__maybe_const<_OtherConst, _View>>> - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const _Iter<_OtherConst>& __lhs, const __sentinel& __rhs) { + friend constexpr bool operator==(const _Iter<_OtherConst>& __lhs, const __sentinel& __rhs) { return __lhs.count() == 0 || __lhs.base() == __rhs.__end_; } }; @@ -250,7 +249,7 @@ struct __fn { // [range.take.overview]: the `empty_view` case. template > _Np> requires __is_empty_view> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Np&&) const + [[nodiscard]] constexpr auto operator()(_Range&& __range, _Np&&) const noexcept(noexcept(_LIBCPP_AUTO_CAST(std::forward<_Range>(__range)))) -> decltype(_LIBCPP_AUTO_CAST(std::forward<_Range>(__range))) { return _LIBCPP_AUTO_CAST(std::forward<_Range>(__range)); @@ -263,7 +262,7 @@ struct __fn { class _Dist = range_difference_t<_Range>> requires(!__is_empty_view<_RawRange> && random_access_range<_RawRange> && sized_range<_RawRange> && __is_passthrough_specialization<_RawRange>) - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto + [[nodiscard]] constexpr auto operator()(_Range&& __rng, _Np&& __n) const noexcept(noexcept(__passthrough_type_t<_RawRange>( ranges::begin(__rng), ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n))))) -> decltype(__passthrough_type_t<_RawRange>( @@ -284,8 +283,7 @@ struct __fn { random_access_range<_RawRange> && sized_range<_RawRange> && __is_iota_specialization<_RawRange>) - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI - constexpr auto operator()(_Range&& __rng, _Np&& __n) const + [[nodiscard]] constexpr auto operator()(_Range&& __rng, _Np&& __n) const noexcept(noexcept(ranges::iota_view( *ranges::begin(__rng), *(ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n))) @@ -307,7 +305,7 @@ struct __fn { class _RawRange = remove_cvref_t<_Range>, class _Dist = range_difference_t<_Range>> requires(__is_repeat_specialization<_RawRange> && sized_range<_RawRange>) - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Np&& __n) const + [[nodiscard]] constexpr auto operator()(_Range&& __range, _Np&& __n) const noexcept(noexcept(views::repeat(*__range.__value_, std::min<_Dist>(ranges::distance(__range), std::forward<_Np>(__n))))) -> decltype( views::repeat(*__range.__value_, std::min<_Dist>(ranges::distance(__range), std::forward<_Np>(__n)))) { return views::repeat(*__range.__value_, std::min<_Dist>(ranges::distance(__range), std::forward<_Np>(__n))); } @@ -318,7 +316,7 @@ struct __fn { class _RawRange = remove_cvref_t<_Range>, class _Dist = range_difference_t<_Range>> requires(__is_repeat_specialization<_RawRange> && !sized_range<_RawRange>) - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Np&& __n) const + [[nodiscard]] constexpr auto operator()(_Range&& __range, _Np&& __n) const noexcept(noexcept(views::repeat(*__range.__value_, static_cast<_Dist>(__n)))) -> decltype( views::repeat(*__range.__value_, static_cast<_Dist>(__n))) { return views::repeat(*__range.__value_, static_cast<_Dist>(__n)); } @@ -336,7 +334,7 @@ struct __fn { (__is_iota_specialization<_RawRange> && sized_range<_RawRange> && random_access_range<_RawRange>) || (__is_passthrough_specialization<_RawRange> && sized_range<_RawRange> && random_access_range<_RawRange>))) - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Np&& __n) const + [[nodiscard]] constexpr auto operator()(_Range&& __range, _Np&& __n) const noexcept(noexcept(take_view(std::forward<_Range>(__range), std::forward<_Np>(__n)))) -> decltype(take_view(std::forward<_Range>(__range), std::forward<_Np>(__n))) { return take_view(std::forward<_Range>(__range), std::forward<_Np>(__n)); @@ -344,8 +342,7 @@ struct __fn { template requires constructible_from, _Np> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Np&& __n) const - noexcept(is_nothrow_constructible_v, _Np>) { + [[nodiscard]] constexpr auto operator()(_Np&& __n) const noexcept(is_nothrow_constructible_v, _Np>) { return __pipeable(std::__bind_back(*this, std::forward<_Np>(__n))); } }; diff --git a/libcxx/include/__ranges/take_while_view.h b/libcxx/include/__ranges/take_while_view.h index 4977f139fc555..02258cb1d371d 100644 --- a/libcxx/include/__ranges/take_while_view.h +++ b/libcxx/include/__ranges/take_while_view.h @@ -54,42 +54,42 @@ class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS take_while_view : public view_interfa _LIBCPP_NO_UNIQUE_ADDRESS __movable_box<_Pred> __pred_; public: - _LIBCPP_HIDE_FROM_ABI take_while_view() + take_while_view() requires default_initializable<_View> && default_initializable<_Pred> = default; - _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 take_while_view(_View __base, _Pred __pred) + constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 take_while_view(_View __base, _Pred __pred) : __base_(std::move(__base)), __pred_(std::in_place, std::move(__pred)) {} - _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& + constexpr _View base() const& requires copy_constructible<_View> { return __base_; } - _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); } + constexpr _View base() && { return std::move(__base_); } - _LIBCPP_HIDE_FROM_ABI constexpr const _Pred& pred() const { return *__pred_; } + constexpr const _Pred& pred() const { return *__pred_; } - _LIBCPP_HIDE_FROM_ABI constexpr auto begin() + constexpr auto begin() requires(!__simple_view<_View>) { return ranges::begin(__base_); } - _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const + constexpr auto begin() const requires range && indirect_unary_predicate> { return ranges::begin(__base_); } - _LIBCPP_HIDE_FROM_ABI constexpr auto end() + constexpr auto end() requires(!__simple_view<_View>) { return __sentinel(ranges::end(__base_), std::addressof(*__pred_)); } - _LIBCPP_HIDE_FROM_ABI constexpr auto end() const + constexpr auto end() const requires range && indirect_unary_predicate> { return __sentinel(ranges::end(__base_), std::addressof(*__pred_)); @@ -111,25 +111,24 @@ class take_while_view<_View, _Pred>::__sentinel { friend class __sentinel; public: - _LIBCPP_HIDE_FROM_ABI __sentinel() = default; + __sentinel() = default; - _LIBCPP_HIDE_FROM_ABI constexpr explicit __sentinel(sentinel_t<_Base> __end, const _Pred* __pred) + constexpr explicit __sentinel(sentinel_t<_Base> __end, const _Pred* __pred) : __end_(std::move(__end)), __pred_(__pred) {} - _LIBCPP_HIDE_FROM_ABI constexpr __sentinel(__sentinel __s) + constexpr __sentinel(__sentinel __s) requires _Const && convertible_to, sentinel_t<_Base>> : __end_(std::move(__s.__end_)), __pred_(__s.__pred_) {} - _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Base> base() const { return __end_; } + constexpr sentinel_t<_Base> base() const { return __end_; } - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const iterator_t<_Base>& __x, const __sentinel& __y) { + friend constexpr bool operator==(const iterator_t<_Base>& __x, const __sentinel& __y) { return __x == __y.__end_ || !std::invoke(*__y.__pred_, *__x); } template requires sentinel_for, iterator_t<__maybe_const<_OtherConst, _View>>> - _LIBCPP_HIDE_FROM_ABI friend constexpr bool - operator==(const iterator_t<__maybe_const<_OtherConst, _View>>& __x, const __sentinel& __y) { + friend constexpr bool operator==(const iterator_t<__maybe_const<_OtherConst, _View>>& __x, const __sentinel& __y) { return __x == __y.__end_ || !std::invoke(*__y.__pred_, *__x); } }; @@ -139,7 +138,7 @@ namespace __take_while { struct __fn { template - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Pred&& __pred) const + [[nodiscard]] constexpr auto operator()(_Range&& __range, _Pred&& __pred) const noexcept(noexcept(/**/ take_while_view(std::forward<_Range>(__range), std::forward<_Pred>(__pred)))) -> decltype(/*--*/ take_while_view(std::forward<_Range>(__range), std::forward<_Pred>(__pred))) { return /*-------------*/ take_while_view(std::forward<_Range>(__range), std::forward<_Pred>(__pred)); @@ -147,7 +146,7 @@ struct __fn { template requires constructible_from, _Pred> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Pred&& __pred) const + [[nodiscard]] constexpr auto operator()(_Pred&& __pred) const noexcept(is_nothrow_constructible_v, _Pred>) { return __pipeable(std::__bind_back(*this, std::forward<_Pred>(__pred))); } diff --git a/libcxx/include/__ranges/to.h b/libcxx/include/__ranges/to.h index 3a2bc42969f7b..975b2ac003f59 100644 --- a/libcxx/include/__ranges/to.h +++ b/libcxx/include/__ranges/to.h @@ -78,7 +78,7 @@ concept __always_false = false; // `ranges::to` base template -- the `_Container` type is a simple type template parameter. template requires(!view<_Container>) -[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Container to(_Range&& __range, _Args&&... __args) { +[[nodiscard]] constexpr _Container to(_Range&& __range, _Args&&... __args) { // Mandates: C is a cv-unqualified class type. static_assert(!is_const_v<_Container>, "The target container cannot be const-qualified, please remove the const"); static_assert( @@ -161,7 +161,7 @@ struct __minimal_input_iterator { // Deduces the full type of the container from the given template template parameter. template