...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::stl_interfaces::range_adaptor_closure
// In header: <boost/stl_interfaces/view_adaptor.hpp> template<typename D, typename > struct range_adaptor_closure { // types typedef int inheritance_tag_with_an_unlikely_name_; // public member functions template<typename T, typename Enable = std::enable_if_t<detail::is_invocable_v<D, T>> > frienddecltype(auto) constexpr operator|(T &&, D &&); template<typename T, typename Enable = std::enable_if_t<detail::is_invocable_v<D const &, T>> > frienddecltype(auto) constexpr operator|(T &&, D const &); };
A backwards-compatible implementation of C++23's std::ranges::range_adaptor_closure
. range_adaptor_closure
may be a struct template or may be an alias, as required to maintain compatability with the standard library's view adaptors.
range_adaptor_closure
public member functionstemplate<typename T, typename Enable = std::enable_if_t<detail::is_invocable_v<D, T>> > frienddecltype(auto) constexpr operator|(T && t, D && d);
template<typename T, typename Enable = std::enable_if_t<detail::is_invocable_v<D const &, T>> > frienddecltype(auto) constexpr operator|(T && t, D const & d);