#pragma once #include #include #include /// Base class for hkArray (a std::vector-like container). // FIXME: incomplete template class hkArrayBase { public: HK_DECLARE_CLASS_ALLOCATOR(hkArrayBase) enum : int { CAPACITY_MASK = 0x3FFFFFFF, FLAG_MASK = 0xC0000000, DONT_DEALLOCATE_FLAG = 0x80000000, }; HK_FORCE_INLINE hkArrayBase(); explicit hkArrayBase(hkFinishLoadedObjectFlag f) {} HK_FORCE_INLINE ~hkArrayBase(); hkArrayBase(const hkArrayBase&) = delete; auto operator=(const hkArrayBase&) = delete; protected: T* m_data; int m_size; int m_capacityAndFlags; }; /// A dynamically resizable array, similar to std::vector. // FIXME: incomplete template class hkArray : public hkArrayBase { public: using AllocatorType = Allocator; HK_FORCE_INLINE hkArray() = default; explicit hkArray(hkFinishLoadedObjectFlag f) : hkArrayBase(f) {} HK_FORCE_INLINE ~hkArray(); HK_FORCE_INLINE hkArray& operator=(const hkArrayBase& other); HK_FORCE_INLINE hkArray& operator=(const hkArray& other); protected: HK_FORCE_INLINE hkArray(const hkArray& other); }; template inline hkArrayBase::hkArrayBase() : m_data(nullptr), m_size(0), m_capacityAndFlags(DONT_DEALLOCATE_FLAG) {} template inline hkArrayBase::~hkArrayBase() { // Assert non-POD element destruction }