Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7268


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
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/libraries/core/ClassTreeMask.cc

    r6417 r7268  
    526526        @return A reference to the mask itself
    527527    */
    528     const ClassTreeMask& ClassTreeMask::operator=(const ClassTreeMask& other)
     528    ClassTreeMask& ClassTreeMask::operator=(const ClassTreeMask& other)
    529529    {
    530530        // Make a copy to avoid troubles with self-assignments (like A = A).
     
    843843        @param mask The mask
    844844    */
    845     const ClassTreeMaskObjectIterator& ClassTreeMaskObjectIterator::operator=(const ClassTreeMask& mask)
     845    ClassTreeMaskObjectIterator& ClassTreeMaskObjectIterator::operator=(const ClassTreeMask& mask)
    846846    {
    847847        // Clear everything, use a cleaned copy of the mask
  • code/trunk/src/libraries/core/ClassTreeMask.h

    r5929 r7268  
    194194            inline BaseObject*          end()   const { return 0; }
    195195
    196             const ClassTreeMask& operator=(const ClassTreeMask& other);
     196            ClassTreeMask& operator=(const ClassTreeMask& other);
    197197
    198198            bool operator==(const ClassTreeMask& other) const;
     
    260260            inline ClassTreeMaskObjectIterator(const ClassTreeMask& mask) { (*this) = mask; }
    261261
    262             const ClassTreeMaskObjectIterator& operator=(const ClassTreeMask& mask);
     262            ClassTreeMaskObjectIterator& operator=(const ClassTreeMask& mask);
    263263
    264264            const ClassTreeMaskObjectIterator& operator++();
  • code/trunk/src/libraries/core/Iterator.h

    r5929 r7268  
    124124                @param exp The exported element
    125125            */
    126             inline const Iterator<T>& operator=(const ObjectListBase::Export& exp)
     126            inline Iterator<T>& operator=(const ObjectListBase::Export& exp)
    127127            {
    128128                if (this->list_)
     
    140140                @param other The other Iterator
    141141            */
    142             inline const Iterator<T>& operator=(const Iterator<T>& other)
     142            inline Iterator<T>& operator=(const Iterator<T>& other)
    143143            {
    144144                if (this->list_)
     
    157157            */
    158158            template <class O>
    159             inline const Iterator<T>& operator=(ObjectListElement<O>* element)
     159            inline Iterator<T>& operator=(ObjectListElement<O>* element)
    160160            {
    161161                if (this->list_)
     
    174174            */
    175175            template <class O>
    176             inline const Iterator<T>& operator=(const ObjectListIterator<O>& other)
     176            inline Iterator<T>& operator=(const ObjectListIterator<O>& other)
    177177            {
    178178                if (this->list_)
  • code/trunk/src/libraries/core/ObjectListIterator.h

    r5929 r7268  
    101101                @param element The ObjectListElement
    102102            */
    103             inline const ObjectListIterator<T>& operator=(ObjectListElement<T>* element)
     103            inline ObjectListIterator<T>& operator=(ObjectListElement<T>* element)
    104104            {
    105105                this->element_ = element;
     
    111111                @param element The other ObjectListIterator
    112112            */
    113             inline const ObjectListIterator<T>& operator=(const ObjectListIterator<T>& other)
     113            inline ObjectListIterator<T>& operator=(const ObjectListIterator<T>& other)
    114114            {
    115115                this->element_ = other.element_;
  • code/trunk/src/libraries/core/SmartPtr.h

    r6417 r7268  
    3636#include <cassert>
    3737
     38#include "Identifier.h"
    3839#include "OrxonoxClass.h"
    3940#include "WeakPtr.h"
     
    8586            }
    8687
    87             inline const SmartPtr& operator=(int)
     88            inline SmartPtr& operator=(int)
    8889            {
    8990                SmartPtr(0).swap(*this);
     
    9192            }
    9293
    93             inline const SmartPtr& operator=(T* pointer)
     94            inline SmartPtr& operator=(T* pointer)
    9495            {
    9596                SmartPtr(pointer).swap(*this);
     
    9798            }
    9899
    99             inline const SmartPtr& operator=(const SmartPtr& other)
     100            inline SmartPtr& operator=(const SmartPtr& other)
    100101            {
    101102                SmartPtr(other).swap(*this);
     
    104105
    105106            template <class O>
    106             inline const SmartPtr& operator=(const SmartPtr<O>& other)
     107            inline SmartPtr& operator=(const SmartPtr<O>& other)
    107108            {
    108109                SmartPtr(other).swap(*this);
     
    111112
    112113            template <class O>
    113             inline const SmartPtr& operator=(const WeakPtr<O>& other)
     114            inline SmartPtr& operator=(const WeakPtr<O>& other)
    114115            {
    115116                SmartPtr(other).swap(*this);
     
    194195    SmartPtr<T> dynamic_pointer_cast(const SmartPtr<U>& p)
    195196    {
    196         return dynamic_cast<T*>(p.get());
     197        return orxonox_cast<T*>(p.get());
    197198    }
    198199}
  • code/trunk/src/libraries/core/SubclassIdentifier.h

    r6417 r7268  
    9191                @return The SubclassIdentifier itself
    9292            */
    93             const SubclassIdentifier<T>& operator=(Identifier* identifier)
     93            SubclassIdentifier<T>& operator=(Identifier* identifier)
    9494            {
    9595                if (!identifier || !identifier->isA(ClassIdentifier<T>::getIdentifier()))
     
    118118            */
    119119            template <class O>
    120             const SubclassIdentifier<T>& operator=(const SubclassIdentifier<O>& identifier)
     120            SubclassIdentifier<T>& operator=(const SubclassIdentifier<O>& identifier)
    121121            {
    122122                return this->operator=(identifier.getIdentifier());
  • code/trunk/src/libraries/core/WeakPtr.h

    r6417 r7268  
    3535
    3636#include <cassert>
     37#include "Identifier.h"
    3738#include "OrxonoxClass.h"
    3839#include "Functor.h"
     
    8283            }
    8384
    84             inline const WeakPtr& operator=(int)
     85            inline WeakPtr& operator=(int)
    8586            {
    8687                WeakPtr(0).swap(*this);
     
    8889            }
    8990
    90             inline const WeakPtr& operator=(T* pointer)
     91            inline WeakPtr& operator=(T* pointer)
    9192            {
    9293                WeakPtr(pointer).swap(*this);
     
    9495            }
    9596
    96             inline const WeakPtr& operator=(const WeakPtr& other)
     97            inline WeakPtr& operator=(const WeakPtr& other)
    9798            {
    9899                WeakPtr(other).swap(*this);
     
    101102
    102103            template <class O>
    103             inline const WeakPtr& operator=(const WeakPtr<O>& other)
     104            inline WeakPtr& operator=(const WeakPtr<O>& other)
    104105            {
    105106                WeakPtr(other).swap(*this);
     
    213214    WeakPtr<T> dynamic_pointer_cast(const WeakPtr<U>& p)
    214215    {
    215         return dynamic_cast<T*>(p.get());
     216        return orxonox_cast<T*>(p.get());
    216217    }
    217218}
  • 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.