Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 21, 2009, 12:54:15 PM (15 years ago)
Author:
rgrieder
Message:

Added TypeTraits.h from the Loki library (stripped it a bit though). This should make things a bit less error prone since Andrei Alexandrescu really is the master of templates ;)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/network/synchronisable/SynchronisableVariable.h

    r3304 r3332  
    3636#include <cstring>
    3737#include "util/Serialise.h"
    38 #include "util/TemplateUtils.h"
     38#include "util/TypeTraits.h"
    3939#include "core/GameMode.h"
    4040#include "network/synchronisable/NetworkCallbackManager.h"
     
    7979      virtual inline void putData(uint8_t*& mem, uint8_t mode, bool forceCallback = false);
    8080      virtual inline uint32_t getSize(uint8_t mode);
    81       virtual inline void* getReference(){ return static_cast<void*>(const_cast<typename TypeStripper<T>::RawType*>(&this->variable_)); }
     81      virtual inline void* getReference(){ return static_cast<void*>(const_cast<typename Loki::TypeTraits<T>::UnqualifiedType*>(&this->variable_)); }
    8282    protected:
    8383     
     
    182182        {
    183183          this->varReference_++;
    184           memcpy(static_cast<void*>(const_cast<typename TypeStripper<T>::RawType*>(&this->varBuffer_)), &this->variable_, sizeof(this->variable_));
     184          memcpy(static_cast<void*>(const_cast<typename Loki::TypeTraits<T>::UnqualifiedType*>(&this->varBuffer_)), &this->variable_, sizeof(this->variable_));
    185185        }
    186186      }
     
    215215          {
    216216            mem += sizeof(varReference_);
    217             memcpy(static_cast<void*>(const_cast<typename TypeStripper<T>::RawType*>(&this->varBuffer_)), &this->variable_, sizeof(T));
     217            memcpy(static_cast<void*>(const_cast<typename Loki::TypeTraits<T>::UnqualifiedType*>(&this->varBuffer_)), &this->variable_, sizeof(T));
    218218            if ( this->callback_ != 0 )
    219219              callback = true;
Note: See TracChangeset for help on using the changeset viewer.