24
Iterators library
[iterators]
24.3
Iterator requirements
[iterator.requirements]
24.3.4
Iterator concepts
[iterator.concepts]
24.3.4.14
Concept
contiguous_
iterator
[iterator.concept.contiguous]
1
#
The
contiguous_
iterator
concept provides a guarantee that the denoted elements are stored contiguously in memory
.
template
<
class
I
>
concept
contiguous_
iterator
=
random_
access_
iterator
<
I
>
&
&
derived_
from
<
ITER_CONCEPT
(
I
)
, contiguous_iterator_tag
>
&
&
is_lvalue_reference_v
<
iter_reference_t
<
I
>
>
&
&
same_
as
<
iter_value_t
<
I
>
, remove_cvref_t
<
iter_reference_t
<
I
>
>
>
&
&
requires
(
const
I
&
i
)
{
{
to_address
(
i
)
}
-
>
same_
as
<
add_pointer_t
<
iter_reference_t
<
I
>
>
>
;
}
;
2
#
Let
a
and
b
be dereferenceable iterators and
c
be a non-dereferenceable iterator of type
I
such that
b
is reachable from
a
and
c
is reachable from
b
, and let
D
be
iter_
difference_
t
<
I
>
.
The type
I
models
contiguous_
iterator
only if
(2.1)
to_
address
(
a
)
=
=
addressof
(
*
a
)
,
(2.2)
to_
address
(
b
)
=
=
to_
address
(
a
)
+
D
(
b
-
a
)
,
(2.3)
to_
address
(
c
)
=
=
to_
address
(
a
)
+
D
(
c
-
a
)
,
(2.4)
ranges
::
iter_
move
(
a
)
has the same type, value category, and effects as
std
::
move
(
*
a
)
, and
(2.5)
if
ranges
::
iter_
swap
(
a, b
)
is well-formed, it has effects equivalent to
ranges
::
swap
(
*
a,
*
b
)
.