25
Ranges library
[ranges]
25.7
Range adaptors
[range.adaptors]
25.7.24
Enumerate view
[range.enumerate]
25.7.24.1
Overview
[range.enumerate.overview]
1
#
enumerate_
view
is a view whose elements represent both the position and value from a sequence of elements
.
2
#
The name
views
::
enumerate
denotes a range adaptor object (
[range.
adaptor.
object]
)
.
Given a subexpression
E
, the expression
views
::
enumerate
(
E
)
is expression-equivalent to
enumerate_
view
<
views
::
all_
t
<
decltype
(
(
E
)
)
>
>
(
E
)
.
[
Example
1
:
vector
<
int
>
vec
{
1
,
2
,
3
}
;
for
(
auto
[
index, value
]
:
views
::
enumerate
(
vec
)
)
cout
<
<
index
<
<
":"
<
<
value
<
<
' '
;
// prints
0:1 1:2 2:3
—
end example
]