[llvm-commits] [llvm] r61622 - /llvm/trunk/include/llvm/ADT/ilist.h
Dan Gohman
gohman at apple.com
Sat Jan 3 19:22:42 PST 2009
Author: djg
Date: Sat Jan 3 21:22:42 2009
New Revision: 61622
URL: http://llvm.org/viewvc/llvm-project?rev=61622&view=rev
Log:
Add several more unimplemented operator overloads to ilist_iterator
to help catch errors.
Modified:
llvm/trunk/include/llvm/ADT/ilist.h
Modified: llvm/trunk/include/llvm/ADT/ilist.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ilist.h?rev=61622&r1=61621&r2=61622&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/ilist.h (original)
+++ llvm/trunk/include/llvm/ADT/ilist.h Sat Jan 3 21:22:42 2009
@@ -107,15 +107,27 @@
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) {}
More information about the llvm-commits
mailing list