Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3233


Ignore:
Timestamp:
Jun 26, 2009, 11:42:34 AM (16 years ago)
Author:
rgrieder
Message:

Possibly reinstated code compliance with GCC 4.4
Could anyone with GCC 4.4 please test this?

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

Legend:

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

    r3196 r3233  
    7676#include <OgreQuaternion.h>
    7777#include <OgreColourValue.h>
     78
     79#include "TemplateUtils.h"
    7880
    7981namespace orxonox
     
    317319            inline void                       resetValue()                    { if (this->value_) this->value_->reset(); }
    318320
    319             template <typename T> inline void setType()                       { this->assignValue(T());                                 } /** @brief Resets the value and changes the internal type to T. */
     321            template <typename T> inline void setType()                       { this->assignValue(TypeStripper<T>::RawType());        } /** @brief Resets the value and changes the internal type to T. */
    320322            inline void                       setType(const MultiType& other) { this->setType(other.getType());                         } /** @brief Resets the value and changes the internal type to the type of the other MultiType. */
    321323            inline void                       setType(MT_Type type)           { this->reset(); this->convert(type); this->resetValue(); } /** @brief Resets the value and changes the internal type to the given type. */
  • code/trunk/src/util/TemplateUtils.h

    r3232 r3233  
    3939namespace orxonox
    4040{
     41    /**
     42    @brief
     43        Use TypeStripper to get rid of the const and the reference of type T
     44    @note
     45        Main use of this is when trying to instantiate type T as T().
     46    */
     47    template <class T> struct TypeStripper
     48        { typedef T RawType; };
     49    template <class T> struct TypeStripper<const T>
     50        { typedef T RawType; };
     51    template <class T> struct TypeStripper<const T&>
     52        { typedef T RawType; };
     53
     54
    4155    ///////////////////////////////////////////////////
    4256    // Static detection of implicit type conversions //
Note: See TracChangeset for help on using the changeset viewer.