26
Ranges library
[ranges]
26.7
Range adaptors
[range.adaptors]
26.7.11
Take while view
[range.take.while]
26.7.11.2
Class template
take_
while_
view
[range.take.while.view]
🔗
namespace
std
::
ranges
{
template
<
view
V,
class
Pred
>
requires
input_
range
<
V
>
&
&
is_object_v
<
Pred
>
&
&
indirect_
unary_
predicate
<
const
Pred, iterator_t
<
V
>
>
class
take_while_view
:
public
view_interface
<
take_while_view
<
V, Pred
>
>
{
//
[range.
take.
while.
sentinel]
, class template
take_
while_
view::
sentinel
template
<
bool
>
class
sentinel
;
//
exposition only
V
base_
=
V
(
)
;
//
exposition only
movable-box
<
Pred
>
pred_
;
//
exposition only
public
:
take_while_view
(
)
requires
default_
initializable
<
V
>
&
&
default_
initializable
<
Pred
>
=
default
;
constexpr
explicit
take_while_view
(
V base, Pred pred
)
;
constexpr
V base
(
)
const
&
requires
copy_
constructible
<
V
>
{
return
base_
;
}
constexpr
V base
(
)
&
&
{
return
std
::
move
(
base_
)
;
}
constexpr
const
Pred
&
pred
(
)
const
;
constexpr
auto
begin
(
)
requires
(
!
simple-view
<
V
>
)
{
return
ranges
::
begin
(
base_
)
;
}
constexpr
auto
begin
(
)
const
requires
range
<
const
V
>
&
&
indirect_
unary_
predicate
<
const
Pred, iterator_t
<
const
V
>
>
{
return
ranges
::
begin
(
base_
)
;
}
constexpr
auto
end
(
)
requires
(
!
simple-view
<
V
>
)
{
return
sentinel
<
false
>
(
ranges
::
end
(
base_
)
, addressof
(
*
pred_
)
)
;
}
constexpr
auto
end
(
)
const
requires
range
<
const
V
>
&
&
indirect_
unary_
predicate
<
const
Pred, iterator_t
<
const
V
>
>
{
return
sentinel
<
true
>
(
ranges
::
end
(
base_
)
, addressof
(
*
pred_
)
)
;
}
}
;
template
<
class
R,
class
Pred
>
take_while_view
(
R
&
&
, Pred
)
-
>
take_while_view
<
views
::
all_t
<
R
>
, Pred
>
;
}
🔗
constexpr
explicit
take_while_view
(
V base, Pred pred
)
;
1
#
Effects
: Initializes
base_
with
std
::
move
(
base
)
and
pred_
with
std
::
move
(
pred
)
.
🔗
constexpr
const
Pred
&
pred
(
)
const
;
2
#
Effects
: Equivalent to:
return
*
pred_
;