[Orxonox-commit 701] r3233 - trunk/src/util
rgrieder at orxonox.net
rgrieder at orxonox.net
Fri Jun 26 11:42:34 CEST 2009
Author: rgrieder
Date: 2009-06-26 11:42:34 +0200 (Fri, 26 Jun 2009)
New Revision: 3233
Modified:
trunk/src/util/MultiType.h
trunk/src/util/TemplateUtils.h
Log:
Possibly reinstated code compliance with GCC 4.4
Could anyone with GCC 4.4 please test this?
Modified: trunk/src/util/MultiType.h
===================================================================
--- trunk/src/util/MultiType.h 2009-06-26 09:41:11 UTC (rev 3232)
+++ trunk/src/util/MultiType.h 2009-06-26 09:42:34 UTC (rev 3233)
@@ -76,6 +76,8 @@
#include <OgreQuaternion.h>
#include <OgreColourValue.h>
+#include "TemplateUtils.h"
+
namespace orxonox
{
/**
@@ -316,7 +318,7 @@
/** @brief Current content gets overridden with default zero value */
inline void resetValue() { if (this->value_) this->value_->reset(); }
- template <typename T> inline void setType() { this->assignValue(T()); } /** @brief Resets the value and changes the internal type to T. */
+ template <typename T> inline void setType() { this->assignValue(TypeStripper<T>::RawType()); } /** @brief Resets the value and changes the internal type to T. */
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. */
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. */
Modified: trunk/src/util/TemplateUtils.h
===================================================================
--- trunk/src/util/TemplateUtils.h 2009-06-26 09:41:11 UTC (rev 3232)
+++ trunk/src/util/TemplateUtils.h 2009-06-26 09:42:34 UTC (rev 3233)
@@ -38,6 +38,20 @@
namespace orxonox
{
+ /**
+ @brief
+ Use TypeStripper to get rid of the const and the reference of type T
+ @note
+ Main use of this is when trying to instantiate type T as T().
+ */
+ template <class T> struct TypeStripper
+ { typedef T RawType; };
+ template <class T> struct TypeStripper<const T>
+ { typedef T RawType; };
+ template <class T> struct TypeStripper<const T&>
+ { typedef T RawType; };
+
+
///////////////////////////////////////////////////
// Static detection of implicit type conversions //
///////////////////////////////////////////////////
More information about the Orxonox-commit
mailing list