Skip to content

[libc++] Rename __range_adaptor_closure_t #110886

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libcxx/include/__ranges/chunk_by_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ struct __fn {
requires constructible_from<decay_t<_Pred>, _Pred>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Pred&& __pred) const
noexcept(is_nothrow_constructible_v<decay_t<_Pred>, _Pred>) {
return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Pred>(__pred)));
return __pipeable(std::__bind_back(*this, std::forward<_Pred>(__pred)));
}
};
} // namespace __chunk_by
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__ranges/drop_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ struct __fn {
requires constructible_from<decay_t<_Np>, _Np>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Np&& __n) const
noexcept(is_nothrow_constructible_v<decay_t<_Np>, _Np>) {
return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Np>(__n)));
return __pipeable(std::__bind_back(*this, std::forward<_Np>(__n)));
}
};

Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__ranges/drop_while_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ struct __fn {
requires constructible_from<decay_t<_Pred>, _Pred>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Pred&& __pred) const
noexcept(is_nothrow_constructible_v<decay_t<_Pred>, _Pred>) {
return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Pred>(__pred)));
return __pipeable(std::__bind_back(*this, std::forward<_Pred>(__pred)));
}
};

Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__ranges/filter_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ struct __fn {
requires constructible_from<decay_t<_Pred>, _Pred>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Pred&& __pred) const
noexcept(is_nothrow_constructible_v<decay_t<_Pred>, _Pred>) {
return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Pred>(__pred)));
return __pipeable(std::__bind_back(*this, std::forward<_Pred>(__pred)));
}
};
} // namespace __filter
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__ranges/lazy_split_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ struct __fn {
requires constructible_from<decay_t<_Pattern>, _Pattern>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Pattern&& __pattern) const
noexcept(is_nothrow_constructible_v<decay_t<_Pattern>, _Pattern>) {
return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Pattern>(__pattern)));
return __pipeable(std::__bind_back(*this, std::forward<_Pattern>(__pattern)));
}
};
} // namespace __lazy_split_view
Expand Down
14 changes: 5 additions & 9 deletions libcxx/include/__ranges/range_adaptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ namespace ranges {
// - `f1 | f2` is an adaptor closure `g` such that `g(x)` is equivalent to `f2(f1(x))`
template <class _Tp>
requires is_class_v<_Tp> && same_as<_Tp, remove_cv_t<_Tp>>
struct __range_adaptor_closure;
struct __range_adaptor_closure {};

// Type that wraps an arbitrary function object and makes it into a range adaptor closure,
// i.e. something that can be called via the `x | f` notation.
template <class _Fn>
struct __range_adaptor_closure_t : _Fn, __range_adaptor_closure<__range_adaptor_closure_t<_Fn>> {
_LIBCPP_HIDE_FROM_ABI constexpr explicit __range_adaptor_closure_t(_Fn&& __f) : _Fn(std::move(__f)) {}
struct __pipeable : _Fn, __range_adaptor_closure<__pipeable<_Fn>> {
_LIBCPP_HIDE_FROM_ABI constexpr explicit __pipeable(_Fn&& __f) : _Fn(std::move(__f)) {}
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(__range_adaptor_closure_t);
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(__pipeable);

template <class _Tp>
_Tp __derived_from_range_adaptor_closure(__range_adaptor_closure<_Tp>*);
Expand All @@ -79,13 +79,9 @@ template <_RangeAdaptorClosure _Closure, _RangeAdaptorClosure _OtherClosure>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator|(_Closure&& __c1, _OtherClosure&& __c2) noexcept(
is_nothrow_constructible_v<decay_t<_Closure>, _Closure> &&
is_nothrow_constructible_v<decay_t<_OtherClosure>, _OtherClosure>) {
return __range_adaptor_closure_t(std::__compose(std::forward<_OtherClosure>(__c2), std::forward<_Closure>(__c1)));
return __pipeable(std::__compose(std::forward<_OtherClosure>(__c2), std::forward<_Closure>(__c1)));
}

template <class _Tp>
requires is_class_v<_Tp> && same_as<_Tp, remove_cv_t<_Tp>>
struct __range_adaptor_closure {};

# if _LIBCPP_STD_VER >= 23
template <class _Tp>
requires is_class_v<_Tp> && same_as<_Tp, remove_cv_t<_Tp>>
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__ranges/split_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ struct __fn {
requires constructible_from<decay_t<_Pattern>, _Pattern>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Pattern&& __pattern) const
noexcept(is_nothrow_constructible_v<decay_t<_Pattern>, _Pattern>) {
return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Pattern>(__pattern)));
return __pipeable(std::__bind_back(*this, std::forward<_Pattern>(__pattern)));
}
};
} // namespace __split_view
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__ranges/take_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ struct __fn {
requires constructible_from<decay_t<_Np>, _Np>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Np&& __n) const
noexcept(is_nothrow_constructible_v<decay_t<_Np>, _Np>) {
return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Np>(__n)));
return __pipeable(std::__bind_back(*this, std::forward<_Np>(__n)));
}
};

Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__ranges/take_while_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ struct __fn {
requires constructible_from<decay_t<_Pred>, _Pred>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Pred&& __pred) const
noexcept(is_nothrow_constructible_v<decay_t<_Pred>, _Pred>) {
return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Pred>(__pred)));
return __pipeable(std::__bind_back(*this, std::forward<_Pred>(__pred)));
}
};

Expand Down
4 changes: 2 additions & 2 deletions libcxx/include/__ranges/to.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ template <class _Container, class... _Args>
}
{ return ranges::to<_Container>(std::forward<_Range>(__range), std::forward<_Tail>(__tail)...); };

return __range_adaptor_closure_t(std::__bind_back(__to_func, std::forward<_Args>(__args)...));
return __pipeable(std::__bind_back(__to_func, std::forward<_Args>(__args)...));
}

// Range adaptor closure object 2 -- wrapping the `ranges::to` version where `_Container` is a template template
Expand All @@ -233,7 +233,7 @@ template <template <class...> class _Container, class... _Args>
};
// clang-format on

return __range_adaptor_closure_t(std::__bind_back(__to_func, std::forward<_Args>(__args)...));
return __pipeable(std::__bind_back(__to_func, std::forward<_Args>(__args)...));
}

} // namespace ranges
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__ranges/transform_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ struct __fn {
requires constructible_from<decay_t<_Fn>, _Fn>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Fn&& __f) const
noexcept(is_nothrow_constructible_v<decay_t<_Fn>, _Fn>) {
return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Fn>(__f)));
return __pipeable(std::__bind_back(*this, std::forward<_Fn>(__f)));
}
};
} // namespace __transform
Expand Down
Loading