Argument-dependent lookup makes it possible to use operators defined in a different namespace. For Example:
If we use ::
std::cout << "Hello\n";
functions that are not visible to ordinary lookup, and can only be found by argument-dependent lookup when std::ranges::empty_view<T> is an associated class of the arguments.
static_assert(0 == a.size());
The enable_view variable template is used to indicate that whether a Range is a View.
(definition of Views has been done in my first article of ranges libraries.)
A type is considered a view if it is unambiguously derived from view_base by default.
For a For a type T, the default value of enable_view<T> is:
If Deriiif DerivedFrom<T, view_base> is true, enable_view<T> is true.
- base_ and pred_ are default initialisers.
- base_ := std::move(base) and pred_ = std::move(pred).
- Initializes base_ with view::all(std::forward<R>(r)) and initializes pred_ with std::%u200Bmove(pred).
Its Parameters are:
- pred - predicate to filter elements.
- r - range to filter.