|
Range primitives | |||||||
|
Range concepts | |||||||||||||||||||
|
Range factories | |||||||||
|
Range adaptors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
Helper items | |||||||||||||||||
|
class/*iterator*/; | (since C++20) (exposition only*) | |
The return type offilter_view::begin.
This is abidirectional_iterator
ifV
modelsbidirectional_range
, aforward_iterator
ifV
modelsforward_range
, andinput_iterator
otherwise.
Modification of the element denoted by this iterator is permitted, but results in undefined behavior if the resulting value does not satisfy the filter's predicate.
Type | Definition |
iterator_concept |
|
iterator_category (present only if V modelsforward_range ) | Let
|
value_type | ranges::range_value_t<V> |
difference_type | ranges::range_difference_t<V> |
Member | Description |
ranges::iterator_t<V>current_ (private) | an iterator into the underlyingview (exposition-only member object*) |
ranges::filter_view<V, Pred>*parent_ (private) | a pointer to the parentfilter_view object(exposition-only member object*) |
constructs an iterator (public member function) | |
returns the underlying iterator (public member function) | |
forwards to the underlying iterator (public member function) | |
advances the iterator (public member function) | |
decrements the iterator (public member function) |
/*iterator*/() requiresstd::default_initializable<ranges::iterator_t<V>>=default; | (1) | (since C++20) |
constexpr/*iterator*/( filter_view& parent, ranges::iterator_t<V> current); | (2) | (since C++20) |
current_
andparent_
with their default member initializers, which are=ranges::iterator_t<V>() and= nullptr respectively.constexprconstranges::iterator_t<V>& base()const&noexcept; | (1) | (since C++20) |
constexprranges::iterator_t<V> base()&&; | (2) | (since C++20) |
constexprranges::range_reference_t<V> operator*()const; | (1) | (since C++20) |
constexprranges::iterator_t<V> operator->()const requires/*has-arrow*/<ranges::iterator_t<V>>&& | (2) | (since C++20) |
For a typeI
,/*has-arrow*/<I> is modeled or satisfied, if and only ifI
models or satisfiesinput_iterator
respectively, and eitherI
is a pointer type orrequires(I i){ i.operator->();} istrue.
constexpr/*iterator*/& operator++(); | (1) | (since C++20) |
constexprvoid operator++(int); | (2) | (since C++20) |
constexpr/*iterator*/ operator++(int) requiresranges::forward_range<V>; | (3) | (since C++20) |
constexpr/*iterator*/& operator--() requiresranges::bidirectional_range<V>; | (1) | (since C++20) |
constexpr/*iterator*/ operator--(int) requiresranges::bidirectional_range<V>; | (2) | (since C++20) |
(C++20) | compares the underlying iterators (function) |
(C++20) | casts the result of dereferencing the underlying iterator to its associated rvalue reference type (function) |
(C++20) | swaps the objects pointed to by two underlying iterators (function) |
friendconstexprbool operator==(const/*iterator*/& x,const/*iterator*/& y) requiresstd::equality_comparable<ranges::iterator_t<V>>; | (since C++20) | |
Equivalent toreturn x.current_== y.current_;.
The!=
operator issynthesized fromoperator==
.
This function is not visible to ordinaryunqualified orqualified lookup, and can only be found byargument-dependent lookup whenstd::ranges::filter_view::iterator
is an associated class of the arguments.
friendconstexprranges::range_rvalue_reference_t<V> iter_move(const/*iterator*/& i) | (since C++20) | |
Equivalent toreturnranges::iter_move(i.current_);.
This function is not visible to ordinaryunqualified orqualified lookup, and can only be found byargument-dependent lookup whenstd::ranges::filter_view::iterator
is an associated class of the arguments.
friendconstexprvoid iter_swap(const/*iterator*/& x,const/*iterator*/& y) noexcept(noexcept(ranges::iter_swap(x.current_, y.current_))) | (since C++20) | |
Equivalent toranges::iter_swap(x.current_, y.current_).
This function is not visible to ordinaryunqualified orqualified lookup, and can only be found byargument-dependent lookup whenstd::ranges::filter_view::iterator
is an associated class of the arguments.
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
DR | Applied to | Behavior as published | Correct behavior |
---|---|---|---|
P2259R1 | C++20 | member typeiterator_category was always defined | defined only ifV is aforward_range |
LWG 3533 | C++20 | theconst& overload ofbase copied the underlying iterator | returns a reference to it |
LWG 3593 | C++20 | theconst& overload ofbase might not be noexcept | made noexcept |