Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
std::ranges...ccess_range(3)  C++ Standard Libary std::ranges...ccess_range(3)

NAME
       std::ranges::random_access_range	- std::ranges::random_access_range

Synopsis
	  Defined in header <ranges>
	  template< class T >

	  concept		      random_access_range		     =
       (since C++20)

	  ranges::bidirectional_range<T> &&
	  std::random_access_iterator<ranges::iterator_t<T>>;

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

Example
       // Run this code

	#include <ranges>
	#include <vector>
	#include <array>
	#include <deque>
	#include <valarray>
	#include <list>
	#include <set>

	template<typename    T>	   concept   RAR   =   std::ranges::random_ac-
       cess_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>>
	    );
	}

See also
	  ranges::sized_range	   specifies that a range knows	 its  size  in
       constant	time
	  (C++20)		   (concept)
	  ranges::contiguous_range  specifies a	range whose iterator type sat-
       isfies
	  (C++20)		   contiguous_iterator
				   (concept)

http://cppreference.com		  2022.07.31	  std::ranges...ccess_range(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=std::ranges::random_access_range&sektion=3&manpath=FreeBSD+Ports+15.0>

home | help