📄 tc3d_traits.h
字号:
/**
* Comet 3D Engine file (c) 2007 - 2008 Tianjie Wei, THSystems Research Group
*
* Released under BSD license, please refer to license.txt for more information
*/
#ifndef _TC3D_TRAITS_H_
#define _TC3D_TRAITS_H_
#include "C3D_Common.h"
#include <new>
namespace C3D
{
namespace Util
{
/**
* Standard object traits
*
* @Author Tianjie (James) Wei
* @Version 3.0
*/
template < class T >
class TC3D_Traits
{
public:
/**
* Converts TC3D_Traits<T> to TC3D_Traits<U>
*/
template < class U >
struct Rebind
{
typedef TC3D_Traits<U> Other;
};
public:
/**
* Class constructor
*/
inline explicit TC3D_Traits()
{
}
/**
* Class constructor for TC3D_Traits<U>
*/
template < class U >
inline explicit TC3D_Traits(const TC3D_Traits<U> &other)
{
}
/**
* Destructor constructor
*/
inline ~TC3D_Traits()
{
}
/**
* Returns the pointer of the object
*/
inline T *Address(T &r)
{
return &r;
}
/**
* Returns the pointer of the object
*/
inline const T *Address(const T &r)
{
return &r;
}
/**
* Constructs the object
*/
inline TC3D_Void Construct(T *ptr, const T &t)
{
new (ptr) T(t);
}
/**
* Destructs the object
*/
inline TC3D_Void Destruct(T *ptr)
{
ptr->~T();
}
};
};
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -