Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 1, 2008, 7:04:09 PM (16 years ago)
Author:
landauf
Message:

merged objecthierarchy branch back to trunk

Location:
code/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/util

  • code/trunk/src/util/Math.h

    r1840 r2087  
    3939#include <ostream>
    4040#include <string>
     41#include <boost/static_assert.hpp>
    4142
    4243#include <OgreMath.h>
     
    189190}
    190191
     192template <typename T>
     193inline T zeroise()
     194{
     195    BOOST_STATIC_ASSERT(sizeof(T) == 0);
     196    return T();
     197}
     198
     199template <> inline char                 zeroise<char>()                 { return 0; }
     200template <> inline unsigned char        zeroise<unsigned char>()        { return 0; }
     201template <> inline short                zeroise<short>()                { return 0; }
     202template <> inline unsigned short       zeroise<unsigned short>()       { return 0; }
     203template <> inline int                  zeroise<int>()                  { return 0; }
     204template <> inline unsigned int         zeroise<unsigned int>()         { return 0; }
     205template <> inline long                 zeroise<long>()                 { return 0; }
     206template <> inline unsigned long        zeroise<unsigned long>()        { return 0; }
     207template <> inline long long            zeroise<long long>()            { return 0; }
     208template <> inline unsigned long long   zeroise<unsigned long long>()   { return 0; }
     209template <> inline float                zeroise<float>()                { return 0; }
     210template <> inline double               zeroise<double>()               { return 0; }
     211template <> inline long double          zeroise<long double>()          { return 0; }
     212template <> inline bool                 zeroise<bool>()                 { return 0; }
     213template <> inline void*                zeroise<void*>()                { return 0; }
     214template <> inline std::string          zeroise<std::string>()          { return ""; }
     215template <> inline orxonox::Radian      zeroise<orxonox::Radian>()      { return orxonox::Radian(0.0f); }
     216template <> inline orxonox::Degree      zeroise<orxonox::Degree>()      { return orxonox::Degree(0.0f); }
     217template <> inline orxonox::Vector2     zeroise<orxonox::Vector2>()     { return orxonox::Vector2    (0, 0)      ; }
     218template <> inline orxonox::Vector3     zeroise<orxonox::Vector3>()     { return orxonox::Vector3    (0, 0, 0)   ; }
     219template <> inline orxonox::Vector4     zeroise<orxonox::Vector4>()     { return orxonox::Vector4    (0, 0, 0, 0); }
     220template <> inline orxonox::ColourValue zeroise<orxonox::ColourValue>() { return orxonox::ColourValue(0, 0, 0, 0); }
     221template <> inline orxonox::Quaternion  zeroise<orxonox::Quaternion>()  { return orxonox::Quaternion (0, 0, 0, 0); }
     222
    191223/**
    192224    @brief Interpolates between two values for a time between 0 and 1.
     
    243275
    244276_UtilExport unsigned long getUniqueNumber();
    245 _UtilExport std::string getUniqueNumberStr();
    246277
    247278class _UtilExport IntVector2
Note: See TracChangeset for help on using the changeset viewer.