24
Ranges library
[ranges]
24.7
Range adaptors
[range.adaptors]
24.7.9
Drop view
[range.drop]
24.7.9.1
Overview
[range.drop.overview]
1
#
drop_view
produces a
view
excluding the first
N
elements from another
view
, or an empty range if the adapted
view
contains fewer than
N
elements
.
2
#
The name
views
::
drop
denotes a range adaptor object (
[range.
adaptor.
object]
)
.
Let
E
and
F
be expressions, let
T
be
remove_cvref_t
<
decltype
(
(
E
)
)
>
, and let
D
be
range_difference_t
<
decltype
(
(
E
)
)
>
.
If
decltype
(
(
F
)
)
does not model
convertible_to
<
D
>
,
views
::
drop
(
E, F
)
is ill-formed
.
Otherwise, the expression
views
::
drop
(
E, F
)
is expression-equivalent to:
(2.1)
If
T
is a specialization of
ranges
::
empty_view
(
[range.
empty.
view]
), then
(
(
void
)
F,
decay-copy
(
E
)
)
.
(2.2)
Otherwise, if
T
models
random_access_range
and
sized_range
and is
(2.2.1)
a specialization of
span
(
[views.
span]
) where
T
::
extent
=
=
dynamic_extent
,
(2.2.2)
a specialization of
basic_string_view
(
[string.
view]
),
(2.2.3)
a specialization of
ranges
::
iota_view
(
[range.
iota.
view]
), or
(2.2.4)
a specialization of
ranges
::
subrange
(
[range.
subrange]
),
then
T
{
ranges
::
begin
(
E
)
+
min
<
D
>
(
ranges
::
size
(
E
)
, F
)
, ranges
::
end
(
E
)
}
, except that
E
is evaluated only once
.
(2.3)
Otherwise,
ranges
::
drop_view
{
E, F
}
.
3
#
[
Example
1
:
auto
ints
=
views
::
iota
(
0
)
|
views
::
take
(
10
)
;
auto
latter_half
=
drop_view
{
ints,
5
}
;
for
(
auto
i
:
latter_half
)
{
cout
<
<
i
<
<
' '
;
// prints
5 6 7 8 9
}
—
end example
]