Changeset 9665 in orxonox.OLD for trunk/src/lib/lang
- Timestamp:
- Aug 20, 2006, 11:39:18 PM (18 years ago)
- Location:
- trunk/src/lib/lang
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/lang/new_class_id.h
r9664 r9665 12 12 13 13 #include "new_object_list.h" 14 15 16 14 17 15 18 //! A class to dynamically allocate ClassID's and support a isA operator -
trunk/src/lib/lang/new_object_list.h
r9664 r9665 40 40 41 41 protected: 42 class IteratorBase { }; 43 42 44 NewObjectListBase(const std::string& className); 43 45 ~NewObjectListBase(); … … 68 70 * @note The Class must define the compare with const std::string& operator for this to work. 69 71 */ 70 template<class T> class NewObjectList : public NewObjectListBase 72 template<class T> 73 class NewObjectList : public NewObjectListBase 71 74 { 72 75 public: 73 76 typedef std::list<T*> list; 74 77 typedef typename list::iterator iterator; 78 79 class Iterator : public NewObjectListBase::IteratorBase 80 { 81 public: 82 typename NewObjectList::iterator it; 83 }; 75 84 76 85 public: … … 82 91 83 92 void registerObject(T* object); 84 void unregisterObject( T* object);93 void unregisterObject(const IteratorBase& iterator); 85 94 86 95 private: … … 88 97 NewObjectList(const NewObjectList& definer) {}; 89 98 99 private: 90 100 list _objects; 91 101 }; 92 102 103 104 105 106 107 ///////////////////////// 108 //// IMPLEMENTATION ///// 109 ///////////////////////// 93 110 template <class T> 94 111 NewObjectList<T>::NewObjectList(const std::string& name) … … 119 136 120 137 template <class T> 121 void NewObjectList<T>::unregisterObject( T* object)138 void NewObjectList<T>::unregisterObject(const IteratorBase& iterator) 122 139 { 123 _objects.erase(std::find(_objects.begin(), _objects.end(), object)); 140 this->_objects.erase(static_cast<Iterator>(iterator)); 141 //_objects.erase(std::find(_objects.begin(), _objects.end(), object)); 124 142 } 125 143
Note: See TracChangeset
for help on using the changeset viewer.