Namespaces
Variants
Views
Actions

std::ranges::contiguous_range

From cppreference.com
< cpp‎ | ranges
 
 
Ranges library
Range access
Range conversions
(C++23)
Range primitives
Dangling iterator handling
Range concepts
Views

Factories
Adaptors
Range adaptor objects
Range adaptor closure objects
Helper items
 
Defined in header <ranges>
template< class T >

  concept contiguous_range =
    ranges::random_access_range<T> &&
    std::contiguous_iterator<ranges::iterator_t<T>> &&
    requires(T& t) {
      { ranges::data(t) } ->
        std::same_as<std::add_pointer_t<ranges::range_reference_t<T>>>;

    };
(since C++20)

The contiguous_range concept is a refinement of range for which ranges::begin returns a model of contiguous_iterator and the customization point ranges::data is usable.

[edit] Semantic requirements

T models contiguous_range only if given an expression e such that decltype((e)) is T&, std::to_address(ranges::begin(e)) == ranges::data(e).