std::ranges::random_access_range - cppreference.com (original) (raw)

The random_access_range concept is a refinement of range for which ranges::begin returns a model of random_access_iterator.

[edit] Example

#include #include #include #include #include #include #include   template concept RAR = std::ranges::random_access_range;   int main() { int a[4]; static_assert( RAR<std::vector> and RAR<std::vector> and RAR<std::deque> and RAR<std::valarray> and RAR<decltype(a)> and not RAR<std::list> and not RAR<std::set> and RAR<std::array<std::list,42>> ); }

[edit] See also