std::ranges::View, std::ranges::enable_view, std::ranges::view_base

< cpp‎ | ranges
Defined in header <ranges>
template<class T>
concept View = Range<T> && Semiregular<T> && enable_view<T>;
template<class T>
inline constexpr bool enable_view = /*see description*/ ;
struct view_base { };
1) The View concept specifies the requirements of a Range type that has constant time copy, move, and assignment operations (e.g. a pair of iterators, or a generator Range that creates its elements on-demand. Notably, the standard library containers are Ranges, but not Views)
2) The enable_view variable template is used to indicate that whether a Range is a View, as follows:

For a type T, the default value of enable_view<T> is:

3) Deriving from view_base enables Range types to model View.


Users may derive from view_base or specialize enable_view to true for types which model View, and specialize enable_view to false for types which do not.