Namespaces
Variants
Views
Actions

std::ranges::viewable_range

From cppreference.com
< cpp‎ | ranges
 
 
 
Defined in header <ranges>
template<class T>

  concept viewable_range =
    ranges::range<T> &&
    ((ranges::view<std::remove_cvref_t<T>> &&
      std::constructible_from<std::remove_cvref_t<T>, T>) ||

     (!ranges::view<std::remove_cvref_t<T>> && ranges::borrowed_range<T>));
(since C++20)

The viewable_range concept is a refinement of range that describes a range that can be safely converted into a view.

[edit] Defect reports

The following behavior-changing defect reports were applied retroactively to previously published C++ standards.

DR Applied to Behavior as published Correct behavior
LWG 3481 C++20 viewable_range accepted an lvalue of a move-only view rejects