std::ranges::random_access_range
Von de.cppreference.net
| Definiert in Header <ranges>
|
||
template< class T >
concept random_access_range =
ranges::bidirectional_range<T> && std::random_access_iterator<ranges::iterator_t<T>>;
|
(seit C++20) | |
Das random_access_range Konzept ist eine Verfeinerung von range, für das ranges::begin ein Modell von random_access_iterator zurückgibt.
Beispiel
Diesen Code ausführen
#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>> ); }
Siehe auch
|
(C++20)
|
spezifiziert, dass ein Bereich seine Größe in konstanter Zeit kennt
(Konzept) |
|
(C++20)
|
spezifiziert einen Bereich, dessen Iteratortyp
contiguous_iterator
erfüllt
(Konzept) |