69 template <
bool, std::
size_t,
class>
78 std::conditional_t<Const, typename TreeSet<Dim>::container_type::const_iterator,
88 using iterator_category = std::forward_iterator_tag;
89 using difference_type = std::ptrdiff_t;
90 using value_type =
typename std::iterator_traits<RawIterator>::value_type;
91 using reference =
typename std::iterator_traits<RawIterator>::reference;
92 using pointer =
typename std::iterator_traits<RawIterator>::pointer;
108 bool Const2,
class Predicate2,
109 std::enable_if_t<(Const && !Const2) ||
110 (Const == Const2 && !std::is_same_v<Predicate, Predicate2>),
125 while (!nextValue()) {
140 reference operator*()
const {
return *it_; }
142 pointer operator->()
const {
return &*it_; }
144 template <
bool Const2,
class Predicate2>
147 return it_ == other.it_;
150 template <
bool Const2,
class Predicate2>
153 return !(*
this == other);
157 [[nodiscard]]
bool returnable(value_type
const& value)
const
159 return Filter::returnable(pred_, value);
162 [[nodiscard]]
bool returnable(
TreeIndex node)
const
164 return ts_->isPureLeaf(node) && !ts_->empty(node);
169 [[nodiscard]]
bool traversable(
TreeIndex node)
const
171 return ts_->isParent(node) && Filter::traversable(pred_, *ts_, ts_->node(node));
181 it_ = std::find_if(it_, last_, [
this](
auto const& v) {
return returnable(v); });
192 while (root_ != cur_) {
193 if (BF - 1 == cur_.offset) {
194 cur_ = ts_->parent(cur_);
200 if (nextNodeDownwards()) {
216 bool nextNodeDownwards()
219 if (returnable(cur_)) {
220 it_ = ts_->values(cur_).begin();
221 last_ = ts_->values(cur_).end();
223 }
else if (traversable(cur_)) {
224 cur_ = ts_->child(cur_, 0);
232 [[nodiscard]] RawIterator iterator() {
return it_; }
236 : ts_(ts), pred_(pred), root_(node), cur_(node)
238 Filter::init(pred_, *ts_);
241 while (!nextValue()) {
249 template <
bool Const2,
class Predicate2,
250 std::enable_if_t<!Const && Const2, bool> =
true>
252 : ts_(other.ts_), pred_(other.pred_), root_(other.root_), cur_(other.cur_)
255 it_ = ts_->values(cur_).erase(other.it_, other.it_);
256 last_ = ts_->values(cur_).erase(other.last_, other.last_);