Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 17, 2016, 10:29:21 PM (8 years ago)
Author:
landauf
Message:

merged branch cpp11_v3 back to trunk

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/libraries/core/object/IteratorBase.h

    r10624 r11071  
    3737
    3838#include "core/CorePrereqs.h"
    39 
    40 #include <boost/static_assert.hpp>
    41 #include <boost/type_traits/is_base_of.hpp>
    4239
    4340#include "ObjectListBase.h"
     
    5249    class IteratorBase : public ObjectListElementRemovalListener
    5350    {
    54         BOOST_STATIC_ASSERT((boost::is_base_of<Listable, T>::value));
    55 
    56         protected:
     51        static_assert(std::is_base_of<Listable, T>::value, "IteratorBase can only be used with Listables");
     52
     53        public:
    5754            /**
    5855                @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)
    6258            {
    6359                this->element_ = element;
     
    6561            }
    6662
    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 
    7863            /**
    7964                @brief Constructor: Sets the element, whereon the iterator points, to the given element of another type.
    8065                The element's type O must be a derivative of the Iterator's type T.
    8166            */
    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();
    9771                this->registerIterator();
    9872            }
     
    172146                @return True if the Iterator points to an existing object.
    173147            */
    174             inline operator bool() const
    175             {
    176                 return (this->element_ != NULL);
     148            inline explicit operator bool() const
     149            {
     150                return (this->element_ != nullptr);
    177151            }
    178152
     
    201175                @param object The object to compare with
    202176            */
    203             virtual void removedElement(ObjectListBaseElement* element)
     177            virtual void removedElement(ObjectListBaseElement* element) override
    204178            {
    205179                if (this->element_ == element)
    206180                    this->operator++();
     181            }
     182
     183            inline ObjectListBaseElement* getElement() const
     184            {
     185                return this->element_;
    207186            }
    208187
     
    226205                }
    227206                else
    228                     this->list_ = NULL;
     207                    this->list_ = nullptr;
    229208            }
    230209
Note: See TracChangeset for help on using the changeset viewer.