Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 10, 2016, 1:54:11 PM (8 years ago)
Author:
landauf
Message:

merged branch cpp11_v2 into cpp11_v3

Location:
code/branches/cpp11_v3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v3

  • code/branches/cpp11_v3/src/libraries/util/MultiType.h

    r10197 r11054  
    175175        public:
    176176            inline MT_ValueBase(void* data, Type::Enum type) : type_(type), bLastConversionSuccessful(true), data_(data) {}
    177             inline virtual ~MT_ValueBase() {}
     177            virtual inline ~MT_ValueBase() {}
    178178
    179179            virtual MT_ValueBase* clone() const = 0;
     
    266266
    267267            /// Default constructor: Assigns no value and no type. The type will be determined by the first assignment of a value.
    268             inline MultiType()                       : value_(0) { }
     268            inline MultiType()                       : value_(nullptr) { }
    269269            /// Constructor: Assigns the given value and sets the type.
    270270            template <typename V>
    271             inline MultiType(const V& value)         : value_(0) { this->set(value); }
     271            inline MultiType(const V& value)         : value_(nullptr) { this->set(value); }
    272272            /// Copyconstructor: Assigns value and type of the other MultiType.
    273             inline MultiType(const MultiType& other) : value_(0) { this->set(other); }
     273            inline MultiType(const MultiType& other) : value_(nullptr) { this->set(other); }
    274274
    275275            /// Destructor: Deletes the MT_Value.
     
    325325                if (this->value_)
    326326                    delete this->value_;
    327                 this->value_ = (other.value_) ? other.value_->clone() : 0;
     327                this->value_ = (other.value_) ? other.value_->clone() : nullptr;
    328328            }
    329329
     
    332332
    333333            /// Resets value and type. Type will be void afterwards and null() returns true.
    334             inline void reset() { if (this->value_) delete this->value_; this->value_ = 0; }
     334            inline void reset() { if (this->value_) delete this->value_; this->value_ = nullptr; }
    335335            /// Resets the value and changes the internal type to T.
    336336            template <typename T> inline void reset() { this->assignValue(typename Loki::TypeTraits<T>::UnqualifiedReferredType()); }
     
    428428            }
    429429            /// Creates a new value container (works only with specialized types).
    430             template <typename T> inline void createNewValueContainer(const T& value) { /* STATIC ASSERT */ *****value; return false; }
     430            template <typename T> inline void createNewValueContainer(const T& value)
     431            {
     432                // If you reach this code, you used MultiType with an unsupported type T
     433                static_assert(sizeof(T) != sizeof(T), "No template specialization available for T");
     434            }
    431435
    432436            MT_ValueBase* value_; //!< A pointer to the value container
     
    486490    template <> inline long double          MultiType::get() const { return (this->value_ ? this->value_->get<long double>()          : 0); }
    487491    template <> inline bool                 MultiType::get() const { return (this->value_ ? this->value_->get<bool>()                 : 0); }
    488     template <> inline void*                MultiType::get() const { return (this->value_ ? this->value_->get<void*>()                : 0); }
     492    template <> inline void*                MultiType::get() const { return (this->value_ ? this->value_->get<void*>()                : nullptr); }
    489493    template <> inline std::string          MultiType::get() const { return (this->value_ ? this->value_->get<std::string>()          : NilValue<std::string>()); }
    490494    template <> inline orxonox::Vector2     MultiType::get() const { return (this->value_ ? this->value_->get<orxonox::Vector2>()     : NilValue<orxonox::Vector2>()); }
Note: See TracChangeset for help on using the changeset viewer.