📄 pre_allocated_array.h
字号:
#ifndef HK_BASE_PRE_ALLOCATED_ARRAY_H
#define HK_BASE_PRE_ALLOCATED_ARRAY_H
#ifndef HK_BASE_BASE_H
# error Include <hk_base/base.h> instead.
#endif
// array class where the elems are allocated just behind
// the array itself
template<class T>
class hk_Pre_Allocated_Array : public hk_Array<T>
{
protected:
inline hk_Pre_Allocated_Array(T* elems, int initial_size)
: hk_Array<T>( elems, initial_size)
{
;
}
public:
inline ~hk_Pre_Allocated_Array()
{
if ( get_elems() == (T*)(this+1))
{
m_elems = 0;
}
}
HK_NEW_DELETE_FUNCTION_CLASS( hk_Pre_Allocated_Array<T>, HK_MEMORY_CLASS_ARRAY ) // e.g. defines new as new (hk_Memory *)hk_Class_Name and delete var, hk_Memory *
};
#endif /* HK_PRE_ALLOCATED_ARRAY_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -