summaryrefslogtreecommitdiffstats
path: root/llvm/include/llvm/ADT/iterator.h
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/include/llvm/ADT/iterator.h')
-rw-r--r--llvm/include/llvm/ADT/iterator.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/include/llvm/ADT/iterator.h b/llvm/include/llvm/ADT/iterator.h
index 8f162da1b54..28dcdf9613e 100644
--- a/llvm/include/llvm/ADT/iterator.h
+++ b/llvm/include/llvm/ADT/iterator.h
@@ -165,9 +165,15 @@ public:
return !static_cast<const DerivedT *>(this)->operator<(RHS);
}
+ PointerT operator->() { return &static_cast<DerivedT *>(this)->operator*(); }
PointerT operator->() const {
return &static_cast<const DerivedT *>(this)->operator*();
}
+ ReferenceProxy operator[](DifferenceTypeT n) {
+ static_assert(IsRandomAccess,
+ "Subscripting is only defined for random access iterators.");
+ return ReferenceProxy(static_cast<DerivedT *>(this)->operator+(n));
+ }
ReferenceProxy operator[](DifferenceTypeT n) const {
static_assert(IsRandomAccess,
"Subscripting is only defined for random access iterators.");
OpenPOWER on IntegriCloud