Add operator[] accessors
authorChris Lattner <sabre@nondot.org>
Thu, 18 Oct 2001 20:04:40 +0000 (20:04 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 18 Oct 2001 20:04:40 +0000 (20:04 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@894 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ValueHolder.h

index 09aa49d05777bfd9bceb2d3878b796192767465c..77bae5d68291a10222be412011f865b38a0aac92 100644 (file)
@@ -25,7 +25,6 @@
 //
 template<class ValueSubclass, class ItemParentType, class SymTabType> 
 class ValueHolder {
-  // TODO: Should I use a deque instead of a vector?
   vector<ValueSubclass*> ValueList;
 
   ItemParentType *ItemParent;
@@ -50,12 +49,18 @@ public:
   inline SymTabType *getParent() { return Parent; }
   void setParent(SymTabType *Parent);  // Defined in ValueHolderImpl.h
 
-  inline unsigned size() const { return ValueList.size(); }
-  inline bool empty()    const { return ValueList.empty(); }
+  inline             unsigned size()  const { return ValueList.size();  }
+  inline                 bool empty() const { return ValueList.empty(); }
   inline const ValueSubclass *front() const { return ValueList.front(); }
   inline       ValueSubclass *front()       { return ValueList.front(); }
-  inline const ValueSubclass *back()  const { return ValueList.back(); }
-  inline       ValueSubclass *back()        { return ValueList.back(); }
+  inline const ValueSubclass *back()  const { return ValueList.back();  }
+  inline       ValueSubclass *back()        { return ValueList.back();  }
+  inline const ValueSubclass *operator[](unsigned i) const {
+    return ValueList[i];
+  }
+  inline       ValueSubclass *operator[](unsigned i) {
+    return ValueList[i];
+  }
 
   //===--------------------------------------------------------------------===//
   // sub-Definition iterator code