|
Range primitives | |||||||
|
Range concepts | ||||||||||||||||||||||||||||||||||
|
|
Range factories | |||||||||
|
Range adaptors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
Helper items | |||||||||||||||||
|
Defined in header <ranges> | ||
template<class T> concept random_access_range= | (since C++20) | |
Therandom_access_range
concept is a refinement ofrange
for whichranges::begin returns a model ofrandom_access_iterator
.
#include <array>#include <deque>#include <list>#include <ranges>#include <set>#include <valarray>#include <vector> template<typename T> concept RAR= std::ranges::random_access_range<T>; int main(){int a[4]; static_assert( RAR<std::vector<int>> and RAR<std::vector<bool>> and RAR<std::deque<int>> and RAR<std::valarray<int>> and RAR<decltype(a)> and not RAR<std::list<int>> and not RAR<std::set<int>> and RAR<std::array<std::list<int>,42>>);}
(C++20) | specifies that a range knows its size in constant time (concept)[edit] |
(C++20) | specifies a range whose iterator type satisfiescontiguous_iterator (concept)[edit] |