[Object][ELF] ELFEntityIterator : Add operators for random access

Add operators add/subtract for random access. This is essentially used by
lld.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232453 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Shankar Easwaran 2015-03-17 02:12:35 +00:00
parent 505179177b
commit 64a7eb58cd

View File

@ -94,6 +94,18 @@ public:
return *this;
}
ELFEntityIterator &operator+(difference_type n) {
assert(Current && "Attempted to increment an invalid iterator!");
Current += n;
return *this;
}
ELFEntityIterator &operator-(difference_type n) {
assert(Current && "Attempted to subtract an invalid iterator!");
Current -= n;
return *this;
}
ELFEntityIterator operator ++(int) {
ELFEntityIterator Tmp = *this;
++*this;