Changeset 3332 for code/trunk/src/core
- Timestamp:
- Jul 21, 2009, 12:54:15 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/core/Identifier.h
r3325 r3332 62 62 63 63 #include "util/Debug.h" 64 #include "util/TypeTraits.h" 64 65 #include "MetaObjectList.h" 65 66 #include "ObjectList.h" … … 483 484 // ### orxonox_cast ### 484 485 // ############################### 485 //! Helper struct to have orxonox_cast<T*> instead of orxonox_cast<T>486 template <class T, class U>487 struct OrxonoxCaster488 {489 static T* cast(U* source)490 {491 // If you see this function in a compiler error description, it means492 // you were misusing orxonox_cast. You must always cast to a pointer type!493 *****T();494 }495 };496 497 //! Helper struct to have orxonox_cast<T*> instead of orxonox_cast<T*>498 template <class T, class U>499 struct OrxonoxCaster<T*, U>500 {501 FORCEINLINE static T* cast(U* source)502 {503 #ifdef ORXONOX_COMPILER_MSVC504 return source->template getDerivedPointer<T>(ClassIdentifier<T>::getIdentifier()->getClassID());505 #else506 return dynamic_cast<T*>(source);507 #endif508 }509 };510 511 486 /** 512 487 @brief … … 523 498 FORCEINLINE T orxonox_cast(U* source) 524 499 { 525 return OrxonoxCaster<T, U>::cast(source); 500 #ifdef ORXONOX_COMPILER_MSVC 501 typedef Loki::TypeTraits<T>::PointeeType ClassType; 502 return source->template getDerivedPointer<ClassType>(ClassIdentifier<ClassType>::getIdentifier()->getClassID()); 503 #else 504 return dynamic_cast<T>(source); 505 #endif 526 506 } 527 507
Note: See TracChangeset
for help on using the changeset viewer.