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

FreeBSD Manual Pages

  
 
  

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

NAME
       std::ranges::common_range - std::ranges::common_range

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

	  concept			 common_range			     =
       (since C++20)

	  ranges::range<T> && std::same_as<ranges::iterator_t<T>,
	  ranges::sentinel_t<T>>;

	  The  common_range  concept  is  a  refinement	 of  range  for	 which
       std::ranges::begin() and
	  std::ranges::end()  return  the same type (e.g. all standard library
       containers).

Example
       // Run this code

	#include <ranges>

	struct A {
	    char* begin();
	    char* end();
	};
	static_assert( std::ranges::common_range<A> );

	struct B {
	    char* begin();
	    bool end();
	};  // not a common_range: begin/end have different types
	static_assert( not std::ranges::common_range<B>	);

	struct C {
	    char* begin();
	};  // not a common_range, not even a range: has no end()
	static_assert( not std::ranges::common_range<C>	);

	int main() { }

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

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

home | help