Range adaptor objects are customization point objects that acceptviewable_range
as their first arguments and return aview
. Some range adaptor objects are unary, i.e. they take oneviewable_range
as their only argument. Other range adaptor objects take aviewable_range
and other trailing arguments.
If a range adaptor object takes only one argument, it is also aRangeAdaptorClosureObject.
If a range adaptor object takes more than one argument, it also supports partial application: let
- a be such a range adaptor object, and
- args... be arguments (generally suitable for trailing arguments),
expressiona(args...) has following properties:
- it is valid if and only if for every argumente inargs... such that
E
isdecltype((e)),std::is_constructible_v<std::decay_t<E>, E> istrue, - when the call is valid, its result object stores a subobject of typestd::decay_t<E> direct-non-list-initialized withstd::forward<E>(e), for every argumente inargs... (in other words, range adaptor objects bind arguments by value),
- the result object is aRangeAdaptorClosureObject,
- calling theRangeAdaptorClosureObject 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 theRangeAdaptorClosureObject.In other words,a(args...)(r) is equivalent tostd::bind_back(a, args...)(r) (but the former also supports the pipe syntax).(since C++23)
Like other customization point objects, let
- a be 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
are all equivalent.
The result object of each of these expressions is either aview
object or aRangeAdaptorClosureObject.
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.