std::ranges::view, std::ranges::enable_view, std::ranges::view_base
From cppreference.com
Defined in header <ranges>
|
||
template<class T> concept view = ranges::range<T> && std::semiregular<T> && ranges::enable_view<T>; |
(1) | |
template<class T> inline constexpr bool enable_view = std::derived_from<T, view_base>; |
(2) | |
struct view_base { }; |
(3) | |
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
range
s, but not view
s)2) The enable_view variable template is used to indicate that whether a range is a view. By default, a type is considered a view if it is publicly and unambiguously derived from view_base.
Users may specialize
enable_view
to true for cv-unqualified program-defined types which model view
, and false for types which do not. Such specializations must be usable in constant expressions and have type const bool
.