SysTutorials

Linux Manual Pages › Section 3

stdrangesviewstdrangesenable_viewstdrangesview_base(3)

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

Synopsis

Defined in header<ranges>
    template <class T>
    (1)
        concept View = Range<T> && Semiregular<T> && enable_view<T>;
template <class T>
(2)
    inline constexpr bool enable_view = /*see description*/;
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 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:
  1. Deriving from view_base enables Range types to model View.

Notes

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.