summaryrefslogtreecommitdiff
path: root/src/wasm-type.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm-type.h')
-rw-r--r--src/wasm-type.h30
1 files changed, 27 insertions, 3 deletions
diff --git a/src/wasm-type.h b/src/wasm-type.h
index 8a9e58ec9..135c2e751 100644
--- a/src/wasm-type.h
+++ b/src/wasm-type.h
@@ -186,15 +186,39 @@ public:
return index == other.index && parent == other.parent;
}
bool operator!=(const Iterator& other) const { return !(*this == other); }
- void operator++() { index++; }
+ Iterator& operator++() {
+ ++index;
+ return *this;
+ }
+ Iterator& operator--() {
+ --index;
+ return *this;
+ }
+ Iterator operator++(int) {
+ auto it = *this;
+ index++;
+ return it;
+ }
+ Iterator operator--(int) {
+ auto it = *this;
+ index--;
+ return it;
+ }
Iterator& operator+=(difference_type off) {
index += off;
return *this;
}
- const Iterator operator+(difference_type off) const {
+ Iterator operator+(difference_type off) const {
return Iterator(*this) += off;
}
- difference_type operator-(const Iterator& other) {
+ Iterator& operator-=(difference_type off) {
+ index -= off;
+ return *this;
+ }
+ Iterator operator-(difference_type off) const {
+ return Iterator(*this) -= off;
+ }
+ difference_type operator-(const Iterator& other) const {
assert(parent == other.parent);
return index - other.index;
}