summaryrefslogtreecommitdiff
path: root/include/llvm/ADT/ilist.h
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-01-04 03:22:42 +0000
committerDan Gohman <gohman@apple.com>2009-01-04 03:22:42 +0000
commit2c8a1522dbe6f14b728e83b9c555bef27233cc91 (patch)
tree17dd06d952a66046c3610b18e0279790b7abc4c1 /include/llvm/ADT/ilist.h
parent64f03003a1cf9fb8f8b068da7fa66a58e86ad390 (diff)
downloadllvm-2c8a1522dbe6f14b728e83b9c555bef27233cc91.tar.gz
llvm-2c8a1522dbe6f14b728e83b9c555bef27233cc91.tar.bz2
llvm-2c8a1522dbe6f14b728e83b9c555bef27233cc91.tar.xz
Add several more unimplemented operator overloads to ilist_iterator
to help catch errors. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61622 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT/ilist.h')
-rw-r--r--include/llvm/ADT/ilist.h20
1 files changed, 16 insertions, 4 deletions
diff --git a/include/llvm/ADT/ilist.h b/include/llvm/ADT/ilist.h
index ea4ca430d5..0acbf46a1a 100644
--- a/include/llvm/ADT/ilist.h
+++ b/include/llvm/ADT/ilist.h
@@ -107,15 +107,27 @@ public:
typedef ilist_traits<NodeTy> Traits;
typedef bidirectional_iterator<NodeTy, ptrdiff_t> super;
- typedef size_t size_type;
+ typedef typename super::value_type value_type;
+ typedef typename super::difference_type difference_type;
typedef typename super::pointer pointer;
typedef typename super::reference reference;
private:
pointer NodePtr;
- // operator[] is not defined. Compile error instead of having a runtime bug.
- void operator[](unsigned) {}
- void operator[](unsigned) const {}
+ // ilist_iterator is not a random-access iterator, but it has an
+ // implicit conversion to pointer-type, which is. Declare (but
+ // don't define) these functions as private to help catch
+ // accidental misuse.
+ void operator[](difference_type) const;
+ void operator+(difference_type) const;
+ void operator-(difference_type) const;
+ void operator+=(difference_type) const;
+ void operator-=(difference_type) const;
+ template<class T> void operator<(T) const;
+ template<class T> void operator<=(T) const;
+ template<class T> void operator>(T) const;
+ template<class T> void operator>=(T) const;
+ template<class T> void operator-(T) const;
public:
ilist_iterator(pointer NP) : NodePtr(NP) {}