mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-21 10:42:07 +00:00
Avoid calling skipEmpty() for AssignedProtos::end()
This commit is contained in:
@@ -89,13 +89,12 @@ private:
|
|||||||
Constness<decltype(_assigned)> *_array = nullptr;
|
Constness<decltype(_assigned)> *_array = nullptr;
|
||||||
Inner _iter{};
|
Inner _iter{};
|
||||||
|
|
||||||
Iter(decltype(_array) array, decltype(_iter) &&iter) : _array(array), _iter(iter) {
|
Iter(decltype(_array) array, decltype(_iter) &&iter) : _array(array), _iter(iter) {}
|
||||||
skipEmpty();
|
Iter &skipEmpty() {
|
||||||
}
|
|
||||||
void skipEmpty() {
|
|
||||||
while (_iter != _array->end() && !_iter->has_value()) {
|
while (_iter != _array->end() && !_iter->has_value()) {
|
||||||
++_iter;
|
++_iter;
|
||||||
}
|
}
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -128,10 +127,12 @@ private:
|
|||||||
};
|
};
|
||||||
public:
|
public:
|
||||||
using iterator = Iter<decltype(_assigned)::iterator, std::remove_const_t>;
|
using iterator = Iter<decltype(_assigned)::iterator, std::remove_const_t>;
|
||||||
iterator begin() { return iterator{&_assigned, _assigned.begin()}; }
|
iterator begin() { return iterator{&_assigned, _assigned.begin()}.skipEmpty(); }
|
||||||
iterator end() { return iterator{&_assigned, _assigned.end()}; }
|
iterator end() { return iterator{&_assigned, _assigned.end()}; }
|
||||||
using const_iterator = Iter<decltype(_assigned)::const_iterator, std::add_const_t>;
|
using const_iterator = Iter<decltype(_assigned)::const_iterator, std::add_const_t>;
|
||||||
const_iterator begin() const { return const_iterator{&_assigned, _assigned.begin()}; }
|
const_iterator begin() const {
|
||||||
|
return const_iterator{&_assigned, _assigned.begin()}.skipEmpty();
|
||||||
|
}
|
||||||
const_iterator end() const { return const_iterator{&_assigned, _assigned.end()}; }
|
const_iterator end() const { return const_iterator{&_assigned, _assigned.end()}; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user