25
Ranges library
[ranges]
25.7
Range adaptors
[range.adaptors]
25.7.32
Stride view
[range.stride]
25.7.32.1
Overview
[range.stride.overview]
1
#
stride_
view
presents a view of an underlying sequence, advancing over
n
elements at a time, as opposed to the usual single-step succession
.
2
#
The name
views
::
stride
denotes a range adaptor object (
[range.
adaptor.
object]
)
.
Given subexpressions
E
and
N
, the expression
views
::
stride
(
E, N
)
is expression-equivalent to
stride_
view
(
E, N
)
.
3
#
[
Example
1
:
auto
input
=
views
::
iota
(
0
,
12
)
|
views
::
stride
(
3
)
; ranges
::
copy
(
input, ostream_iterator
<
int
>
(
cout,
" "
)
)
;
// prints
0 3 6 9
ranges
::
copy
(
input
|
views
::
reverse, ostream_iterator
<
int
>
(
cout,
" "
)
)
;
// prints
9 6 3 0
—
end example
]