mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-15 22:28:18 +00:00
Recommit simplification first attempted in r232309 (fixed a bit in r232312, with fixes in r232314)
Messed it up because I didn't realize there were two different iterators here (& clearly didn't build any of this... ) - still seems easier to just use the injected class name than introduce a self typedef. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232462 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -654,7 +654,6 @@ public:
|
|||||||
Flags=0x3 };
|
Flags=0x3 };
|
||||||
|
|
||||||
typedef ImutAVLTree<ImutInfo> TreeTy;
|
typedef ImutAVLTree<ImutInfo> TreeTy;
|
||||||
typedef ImutAVLTreeGenericIterator<ImutInfo> SelfTy;
|
|
||||||
|
|
||||||
ImutAVLTreeGenericIterator() {}
|
ImutAVLTreeGenericIterator() {}
|
||||||
ImutAVLTreeGenericIterator(const TreeTy *Root) {
|
ImutAVLTreeGenericIterator(const TreeTy *Root) {
|
||||||
@@ -696,11 +695,15 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const SelfTy &x) const { return stack == x.stack; }
|
bool operator==(const ImutAVLTreeGenericIterator &x) const {
|
||||||
|
return stack == x.stack;
|
||||||
|
}
|
||||||
|
|
||||||
bool operator!=(const SelfTy &x) const { return !operator==(x); }
|
bool operator!=(const ImutAVLTreeGenericIterator &x) const {
|
||||||
|
return !(*this == x);
|
||||||
|
}
|
||||||
|
|
||||||
SelfTy &operator++() {
|
ImutAVLTreeGenericIterator &operator++() {
|
||||||
assert(!stack.empty());
|
assert(!stack.empty());
|
||||||
TreeTy* Current = reinterpret_cast<TreeTy*>(stack.back() & ~Flags);
|
TreeTy* Current = reinterpret_cast<TreeTy*>(stack.back() & ~Flags);
|
||||||
assert(Current);
|
assert(Current);
|
||||||
@@ -726,7 +729,7 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
SelfTy &operator--() {
|
ImutAVLTreeGenericIterator &operator--() {
|
||||||
assert(!stack.empty());
|
assert(!stack.empty());
|
||||||
TreeTy* Current = reinterpret_cast<TreeTy*>(stack.back() & ~Flags);
|
TreeTy* Current = reinterpret_cast<TreeTy*>(stack.back() & ~Flags);
|
||||||
assert(Current);
|
assert(Current);
|
||||||
@@ -761,7 +764,6 @@ class ImutAVLTreeInOrderIterator
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
typedef ImutAVLTree<ImutInfo> TreeTy;
|
typedef ImutAVLTree<ImutInfo> TreeTy;
|
||||||
typedef ImutAVLTreeInOrderIterator<ImutInfo> SelfTy;
|
|
||||||
|
|
||||||
ImutAVLTreeInOrderIterator(const TreeTy* Root) : InternalItr(Root) {
|
ImutAVLTreeInOrderIterator(const TreeTy* Root) : InternalItr(Root) {
|
||||||
if (Root)
|
if (Root)
|
||||||
@@ -770,16 +772,18 @@ public:
|
|||||||
|
|
||||||
ImutAVLTreeInOrderIterator() : InternalItr() {}
|
ImutAVLTreeInOrderIterator() : InternalItr() {}
|
||||||
|
|
||||||
bool operator==(const SelfTy &x) const {
|
bool operator==(const ImutAVLTreeInOrderIterator &x) const {
|
||||||
return InternalItr == x.InternalItr;
|
return InternalItr == x.InternalItr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const SelfTy &x) const { return !(*this == x); }
|
bool operator!=(const ImutAVLTreeInOrderIterator &x) const {
|
||||||
|
return !(*this == x);
|
||||||
|
}
|
||||||
|
|
||||||
TreeTy &operator*() const { return *InternalItr; }
|
TreeTy &operator*() const { return *InternalItr; }
|
||||||
TreeTy *operator->() const { return &*InternalItr; }
|
TreeTy *operator->() const { return &*InternalItr; }
|
||||||
|
|
||||||
SelfTy &operator++() {
|
ImutAVLTreeInOrderIterator &operator++() {
|
||||||
do ++InternalItr;
|
do ++InternalItr;
|
||||||
while (!InternalItr.atEnd() &&
|
while (!InternalItr.atEnd() &&
|
||||||
InternalItr.getVisitState() != InternalIteratorTy::VisitedLeft);
|
InternalItr.getVisitState() != InternalIteratorTy::VisitedLeft);
|
||||||
@@ -787,7 +791,7 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
SelfTy &operator--() {
|
ImutAVLTreeInOrderIterator &operator--() {
|
||||||
do --InternalItr;
|
do --InternalItr;
|
||||||
while (!InternalItr.atBeginning() &&
|
while (!InternalItr.atBeginning() &&
|
||||||
InternalItr.getVisitState() != InternalIteratorTy::VisitedLeft);
|
InternalItr.getVisitState() != InternalIteratorTy::VisitedLeft);
|
||||||
|
Reference in New Issue
Block a user