C++ named requirements: RangeAdaptorObject (od C++20)
Range adaptor objects are customization point objects that accept viewable_range as their first arguments and return a view. Some range adaptor objects are unary, i.e. they take one viewable_range as their only argument. Other range adaptor objects take a viewable_range and other trailing arguments.
If a range adaptor object takes only one argument, it is also a RangeAdaptorClosureObject.
If a range adaptor object takes more than one argument, it also supports partial application: let
abe such a range adaptor object, andargs...be arguments (generally suitable for trailing arguments),- expression
a(args...)has following properties:- it is valid if and only if for every argument
einargs...such that E isdecltype((e)),std::is_constructible_v<std::decay_t<E>, E>is true, - when the call is valid, its result object stores a subobject of type
std::decay_tdirect-non-list-initialized withstd::forward<E>(e), for every argumenteinargs...(in other words, range adaptor objects bind arguments by value), - the result object is a RangeAdaptorClosureObject,
- calling the RangeAdaptorClosureObject forwards the bound arguments (if any) to the associated range adaptor object.
The bound arguments (if any) are considered to have the value category and cv-qualification of the RangeAdaptorClosureObject.
In other words,
a(args...)(r)is equivalent tostd::bind_back(a, args...)(r)(but the former also supports the pipe syntax) (od C++23)
- it is valid if and only if for every argument
Like other customization point objects, let
abe an object of the cv-unqualified version of the type of any range adaptor objects,args...be any group of arguments that satisfies the constraints of theoperator()of the type ofa,
calls to
a(args...),std::as_const(a)(args...),std::move(a)(args...), and-
std::move(std::as_const(a))(args...)
are all equivalent.
The result object of each of these expressions is either a view object or a RangeAdaptorClosureObject.
Notes
operator() is unsupported for volatile-qualified or const-volatile-qualified version of range adaptor object types.
Arrays and functions are converted to pointers while binding.