23 Ranges library [ranges]

23.5 Range requirements [range.req]

23.5.4 Views [range.view]

The View concept specifies the requirements of a Range type that has constant time copy, move, and assignment operators; that is, the cost of these operations is not proportional to the number of elements in the View.
[Example
:
Examples of Views are:
  • A Range type that wraps a pair of iterators.
  • A Range type that holds its elements by shared_­ptr and shares ownership with all its copies.
  • A Range type that generates its elements on demand.
Most containers are not views since copying the container copies the elements, which cannot be done in constant time.
end example
]
template<class T> inline constexpr bool enable_view = see below; template<class T> concept View = Range<T> && Semiregular<T> && enable_view<T>;
Since the difference between Range and View is largely semantic, the two are differentiated with the help of enable_­view.
For a type T, the default value of enable_­view<T> is:
Pursuant to [namespace.std], users may specialize enable_­view to true for types which model View, and false for types which do not.