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>> {
template<bool> class sentinel;
V base_ = V();
semiregular-box<Pred> pred_;
public:
take_while_view() = default;
constexpr 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>
{ 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>
{ 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 take_while_view(V base, Pred pred);
Effects:
Initializes
base_ with
std::move(base) and
pred_ with
std::move(pred). constexpr const Pred& pred() const;
Effects:
Equivalent to: return *pred_;