Namespaces
Variants
Actions

std::ranges::take_while_view<V,Pred>::take_while_view

From cppreference.com
 
C++
 
Ranges library
Range adaptors
 
std::ranges::take_while_view
take_while_view() requires std::default_initializable<V> &&
                           std::default_initializable<Pred> = default;
(1) (since C++20)
constexpr explicit take_while_view( V base, Pred pred );
(2) (since C++20)

Constructs a take_while_view.

1) Default constructor. Value-initializes the underlying view and the predicate.
2) Move constructs the underlying view base_ from base and the predicate pred_ from pred.

[edit] Parameters

base - underlying view
fun - predicate

[edit] Example

[edit] Defect reports

The following behavior-changing defect reports were applied retroactively to previously published C++ standards.

DR Applied to Behavior as published Correct behavior
P2711R1) C++20 the multi-parameter constructor was not explicit made explicit
P2325R3 C++20 if Pred is not default_initializable, the default constructor
constructs a take_while_view which does not contain an Pred
the take_while_view is also
not default_initializable

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant