|
libzypp 17.38.7
|
A simple forward iterator that filters a base range according to a predicate. More...
#include <zypp-core/ng/base/iterators.h>
Public Types | |
| using | iterator_category = std::forward_iterator_tag |
| using | value_type = typename std::iterator_traits<Base>::value_type |
| using | difference_type = typename std::iterator_traits<Base>::difference_type |
| using | pointer = typename std::iterator_traits<Base>::pointer |
| using | reference = typename std::iterator_traits<Base>::reference |
Public Member Functions | |
| FilterIterator ()=default | |
| Default constructor. | |
| FilterIterator (Pred p, Base it, Base end) | |
| Constructs a FilterIterator. | |
| reference | operator* () const |
| Dereference operator. | |
| pointer | operator-> () const |
| Arrow operator. | |
| FilterIterator & | operator++ () |
| Pre-increment operator. | |
| FilterIterator | operator++ (int) |
| Post-increment operator. | |
| bool | operator== (const FilterIterator &other) const |
| Equality comparison. | |
| bool | operator!= (const FilterIterator &other) const |
| Inequality comparison. | |
| Base const & | base () const |
| Returns the underlying base iterator at its current position. | |
Private Member Functions | |
| void | satisfy_predicate () |
| Advances the internal iterator until the predicate is met or _end is reached. | |
Private Attributes | |
| Pred | _pred |
| Base | _it |
| Base | _end |
A simple forward iterator that filters a base range according to a predicate.
This class serves as a C++17 compatible drop-in replacement for boost::filter_iterator. It is designed as a stopgap measure to eliminate Boost dependencies in the Next-Generation (NG) layer until full C++20 std::ranges or a polyfill like range-v3 is integrated.
The iterator takes a predicate (which returns true for elements that should be included) and a pair of iterators (it and end) representing the underlying sequence. Whenever incremented, it automatically advances until the predicate is satisfied or the end boundary is reached.
| Pred | A callable that takes a value of the base sequence and returns bool. |
| Base | The underlying forward iterator type. |
Definition at line 39 of file iterators.h.
| using zyppng::FilterIterator< Pred, Base >::iterator_category = std::forward_iterator_tag |
Definition at line 41 of file iterators.h.
| using zyppng::FilterIterator< Pred, Base >::value_type = typename std::iterator_traits<Base>::value_type |
Definition at line 42 of file iterators.h.
| using zyppng::FilterIterator< Pred, Base >::difference_type = typename std::iterator_traits<Base>::difference_type |
Definition at line 43 of file iterators.h.
| using zyppng::FilterIterator< Pred, Base >::pointer = typename std::iterator_traits<Base>::pointer |
Definition at line 44 of file iterators.h.
| using zyppng::FilterIterator< Pred, Base >::reference = typename std::iterator_traits<Base>::reference |
Definition at line 45 of file iterators.h.
|
default |
Default constructor.
Creates an invalid/end iterator.
|
inline |
Constructs a FilterIterator.
| p | The predicate used to filter elements. |
| it | The start of the base sequence. |
| end | The end of the base sequence. |
Definition at line 56 of file iterators.h.
|
inline |
Dereference operator.
Definition at line 63 of file iterators.h.
|
inline |
Arrow operator.
Definition at line 66 of file iterators.h.
|
inline |
Pre-increment operator.
Advances to the next element satisfying the predicate.
Definition at line 69 of file iterators.h.
|
inline |
Post-increment operator.
Definition at line 76 of file iterators.h.
|
inline |
Equality comparison.
Definition at line 83 of file iterators.h.
|
inline |
Inequality comparison.
Definition at line 88 of file iterators.h.
|
inline |
Returns the underlying base iterator at its current position.
Definition at line 93 of file iterators.h.
|
inlineprivate |
Advances the internal iterator until the predicate is met or _end is reached.
Definition at line 97 of file iterators.h.
|
private |
Definition at line 103 of file iterators.h.
|
private |
Definition at line 104 of file iterators.h.
|
private |
Definition at line 105 of file iterators.h.