Scroll to navigation

std::contiguous_iterator(3) C++ Standard Libary std::contiguous_iterator(3)

NAME

std::contiguous_iterator - std::contiguous_iterator

Synopsis


Defined in header <iterator>
template< class I >


concept contiguous_iterator =
std::random_access_iterator<I> &&
std::derived_from</*ITER_CONCEPT*/<I>,
std::contiguous_iterator_tag> &&
std::is_lvalue_reference_v<std::iter_reference_t<I>> &&
std::same_as< (since
std::iter_value_t<I>, C++20)
std::remove_cvref_t<std::iter_reference_t<I>>
> &&
requires(const I& i) {
{ std::to_address(i) } ->
std::same_as<std::add_pointer_t<std::iter_reference_t<I>>>;


};


The contiguous_iterator concept refines random_access_iterator by providing a
guarantee the denoted elements are stored contiguously in the memory.

Notes


contiguous_iterator is modeled by every pointer type to complete object type.


Iterator types in the standard library that are required to satisfy the
LegacyContiguousIterator requirements in C++17 are also required to model
contiguous_iterator in C++20.

See also


specifies that a bidirectional_iterator is a random-access
random_access_iterator iterator, supporting advancement in constant time and
(C++20) subscripting
(concept)

2024.06.10 http://cppreference.com