3.6 KiB
[range.take.while.view]
25 Ranges library [ranges]
25.7 Range adaptors [range.adaptors]
25.7.11 Take while view [range.take.while]
25.7.11.2 Class template take_while_view [range.take.while.view]
namespace std::ranges {template<view V, class Pred>requires input_range && is_object_v &&indirect_unary_predicate<const Pred, iterator_t>class take_while_view : public view_interface<take_while_view<V, Pred>> {// [range.take.while.sentinel], class template take_while_view::sentineltemplate class sentinel; // exposition only V base_ = V(); // exposition only**movable-box pred_; // exposition onlypublic: take_while_view() requires default_initializable && default_initializable = default; constexpr explicit take_while_view(V base, Pred pred); constexpr V base() const & requires copy_constructible { return base_; }constexpr V base() && { return std::move(base_); }constexpr const Pred& pred() const; constexpr auto begin() requires (){ return ranges::begin(base_); }constexpr auto begin() constrequires range &&indirect_unary_predicate<const Pred, iterator_t>{ return ranges::begin(base_); }constexpr auto end() requires (
){ return sentinel(ranges::end(base_), addressof(**pred_)); }constexpr auto end() constrequires range &&indirect_unary_predicate<const Pred, iterator_t>{ return sentinel(ranges::end(base_), addressof(**pred_)); }}; template<class R, class Pred> take_while_view(R&&, Pred) -> take_while_view<views::all_t, Pred>;}
constexpr explicit take_while_view(V base, Pred pred);
Effects: Initializes base_ with std::move(base) andpred_ with std::move(pred).
constexpr const Pred& pred() const;
Effects: Equivalent to: return **pred_*;