70 template <
bool, std::
size_t,
class,
class>
79 std::conditional_t<Const, typename TreeMap<Dim, T>::container_type::const_iterator,
89 using iterator_category = std::forward_iterator_tag;
90 using difference_type = std::ptrdiff_t;
91 using value_type =
typename std::iterator_traits<RawIterator>::value_type;
92 using reference =
typename std::iterator_traits<RawIterator>::reference;
93 using pointer =
typename std::iterator_traits<RawIterator>::pointer;
101 bool Const2,
class Predicate2,
102 std::enable_if_t<(Const && !Const2) ||
103 (Const == Const2 && !std::is_same_v<Predicate, Predicate2>),
118 while (!nextValue()) {
133 reference operator*()
const {
return *it_; }
135 pointer operator->()
const {
return &*it_; }
137 template <
bool Const2,
class Predicate2>
140 return it_ == other.it_;
143 template <
bool Const2,
class Predicate2>
146 return !(*
this == other);
150 [[nodiscard]]
bool returnable(value_type
const& value)
const
152 return Filter::returnable(pred_, value);
155 [[nodiscard]]
bool returnable(
TreeIndex node)
const
157 return tm_->isPureLeaf(node) && !tm_->empty(node);
162 [[nodiscard]]
bool traversable(
TreeIndex node)
const
164 return tm_->isParent(node) && Filter::traversable(pred_, *tm_, tm_->node(node));
174 it_ = std::find_if(it_, last_, [
this](
auto const& v) {
return returnable(v); });
185 while (root_ != cur_) {
186 if (BF - 1 == cur_.offset) {
187 cur_ = tm_->parent(cur_);
193 if (nextNodeDownwards()) {
209 bool nextNodeDownwards()
212 if (returnable(cur_)) {
213 it_ = tm_->values(cur_).begin();
214 last_ = tm_->values(cur_).end();
216 }
else if (traversable(cur_)) {
217 cur_ = tm_->child(cur_, 0);
225 [[nodiscard]] RawIterator iterator() {
return it_; }
229 : tm_(tm), pred_(pred), root_(node), cur_(node)
231 Filter::init(pred_, *tm_);
234 while (!nextValue()) {
242 template <
bool Const2,
class Predicate2,
243 std::enable_if_t<!Const && Const2, bool> =
true>
245 : tm_(other.tm_), pred_(other.pred_), root_(other.root_), cur_(other.cur_)
248 it_ = tm_->values(cur_).erase(other.it_, other.it_);
249 last_ = tm_->values(cur_).erase(other.last_, other.last_);