Changeset 11071 for code/trunk/src/libraries/core/object/IteratorBase.h
- Timestamp:
- Jan 17, 2016, 10:29:21 PM (9 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/libraries/core/object/IteratorBase.h
r10624 r11071 37 37 38 38 #include "core/CorePrereqs.h" 39 40 #include <boost/static_assert.hpp>41 #include <boost/type_traits/is_base_of.hpp>42 39 43 40 #include "ObjectListBase.h" … … 52 49 class IteratorBase : public ObjectListElementRemovalListener 53 50 { 54 BOOST_STATIC_ASSERT((boost::is_base_of<Listable, T>::value));55 56 p rotected:51 static_assert(std::is_base_of<Listable, T>::value, "IteratorBase can only be used with Listables"); 52 53 public: 57 54 /** 58 55 @brief Constructor: Sets the element, whereon the iterator points, to the given element. 59 This constructor is protected and only for internal usage (don't mess with the BaseElements directly). 60 */ 61 inline IteratorBase(ObjectListBaseElement* element = NULL) 56 */ 57 inline IteratorBase(ObjectListElement<T>* element = nullptr) 62 58 { 63 59 this->element_ = element; … … 65 61 } 66 62 67 68 public:69 /**70 @brief Constructor: Sets the element, whereon the iterator points, to the given element.71 */72 inline IteratorBase(ObjectListElement<T>* element)73 {74 this->element_ = element;75 this->registerIterator();76 }77 78 63 /** 79 64 @brief Constructor: Sets the element, whereon the iterator points, to the given element of another type. 80 65 The element's type O must be a derivative of the Iterator's type T. 81 66 */ 82 template <class O> 83 inline IteratorBase(ObjectListElement<O>* element) 84 { 85 (void)static_cast<T*>((O*)NULL); // Check type: The element's type O must be a derivative of the Iterator's type T. 86 this->element_ = element; 87 this->registerIterator(); 88 } 89 90 /** 91 @brief Constructor: Sets this element to the element of another Iterator. 92 @param other The other Iterator 93 */ 94 inline IteratorBase(const IteratorBase& other) 95 { 96 this->element_ = other.element_; 67 template <class OT, class OI> 68 inline IteratorBase(const IteratorBase<OT, OI>& other) 69 { 70 this->element_ = other.getElement(); 97 71 this->registerIterator(); 98 72 } … … 172 146 @return True if the Iterator points to an existing object. 173 147 */ 174 inline operator bool() const175 { 176 return (this->element_ != NULL);148 inline explicit operator bool() const 149 { 150 return (this->element_ != nullptr); 177 151 } 178 152 … … 201 175 @param object The object to compare with 202 176 */ 203 virtual void removedElement(ObjectListBaseElement* element) 177 virtual void removedElement(ObjectListBaseElement* element) override 204 178 { 205 179 if (this->element_ == element) 206 180 this->operator++(); 181 } 182 183 inline ObjectListBaseElement* getElement() const 184 { 185 return this->element_; 207 186 } 208 187 … … 226 205 } 227 206 else 228 this->list_ = NULL;207 this->list_ = nullptr; 229 208 } 230 209
Note: See TracChangeset
for help on using the changeset viewer.