26
Ranges library
[ranges]
26.7
Range adaptors
[range.adaptors]
26.7.9
Transform view
[range.transform]
26.7.9.1
Overview
[range.transform.overview]
1
#
transform_
view
presents a view of an underlying sequence after applying a transformation function to each element
.
2
#
The name
views
::
transform
denotes a range adaptor object (
[range.
adaptor.
object]
)
.
Given subexpressions
E
and
F
, the expression
views
::
transform
(
E, F
)
is expression-equivalent to
transform_
view
(
E, F
)
.
3
#
[
Example
1
:
vector
<
int
>
is
{
0
,
1
,
2
,
3
,
4
}
;
auto
squares
=
views
::
transform
(
is,
[
]
(
int
i
)
{
return
i
*
i;
}
)
;
for
(
int
i
:
squares
)
cout
<
<
i
<
<
' '
;
// prints
0 1 4 9 16
—
end example
]