On this page
std::ranges::common_range
Defined in header <ranges> |
||
---|---|---|
|
(since C++20) |
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
#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() { }
See also
(C++20)
|
converts a view into a common_range (class template) (range adaptor object) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/w/cpp/ranges/common_range