24
Ranges library
[ranges]
24.7
Range adaptors
[range.adaptors]
24.7.6
Transform view
[range.transform]
24.7.6.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
}
; transform_view squares
{
is,
[
]
(
int
i
)
{
return
i
*
i;
}
}
;
for
(
int
i
:
squares
)
cout
<
<
i
<
<
' '
;
// prints: 0 1 4 9 16
—
end example
]