Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 30, 2010, 7:34:07 PM (14 years ago)
Author:
rgrieder
Message:

operator=() should not return constant references.

Location:
code/trunk/src/libraries/util
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/libraries/util/MultiType.h

    r7266 r7268  
    272272            inline ~MultiType() { if (this->value_) { delete this->value_; } }
    273273
    274             template <typename V> inline const MultiType& operator=(const V& value)         { this->setValue(value); return (*this); } /** @brief Assigns a new value. The value will be converted to the current type of the MultiType. */
    275             template <typename V> inline const MultiType& operator=(V* value)               { this->setValue(value); return (*this); } /** @brief Assigns a pointer. */
    276             inline                       const MultiType& operator=(const MultiType& other) { this->setValue(other); return (*this); } /** @brief Assigns the value of the other MultiType and converts it to the current type of the MultiType. */
    277             inline                       const MultiType& operator=(MT_Type::Value type)    { this->setType(type);   return (*this); } /** @brief Resets the value and changes the type. */
     274            template <typename V> inline MultiType& operator=(const V& value)         { this->setValue(value); return (*this); } /** @brief Assigns a new value. The value will be converted to the current type of the MultiType. */
     275            template <typename V> inline MultiType& operator=(V* value)               { this->setValue(value); return (*this); } /** @brief Assigns a pointer. */
     276            inline                       MultiType& operator=(const MultiType& other) { this->setValue(other); return (*this); } /** @brief Assigns the value of the other MultiType and converts it to the current type of the MultiType. */
     277            inline                       MultiType& operator=(MT_Type::Value type)    { this->setType(type);   return (*this); } /** @brief Resets the value and changes the type. */
    278278
    279279            inline bool                                   setValue(const char& value);
  • code/trunk/src/libraries/util/mbool.h

    r6417 r7268  
    4242                { this->value_.memory_ = value.value_.memory_; }
    4343
    44             inline const mbool& operator=(bool value)
     44            inline mbool& operator=(bool value)
    4545                { if (value != this->value_.bool_) { ++this->value_.memory_; } return (*this); }
    46             inline const mbool& operator=(const mbool& value)
     46            inline mbool& operator=(const mbool& value)
    4747                { this->value_.memory_ = value.value_.memory_; return (*this); }
    4848
Note: See TracChangeset for help on using the changeset viewer.