/
redgpu
/
ezEngine
Обзор
Документация
Войти
/
redgpu
/
ezEngine
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
Code/Engine/Foundation/Containers/Implementation/StaticArray_inl.h
93 строки
3 KB
C-Core
Re-enabled security relevant warnings (#1339)
25 июн 2024, 12:03
Не верифицирован
25 июн 2024, 12:03
7083663
Код
Авторство
О чём код?
template <typename T, ezUInt32 C> ezStaticArray<T, C>::ezStaticArray() { EZ_ASSERT_DEBUG(this->m_pElements == nullptr, "static arrays should not use m_pElements"); this->m_uiCapacity = C; } template <typename T, ezUInt32 C> ezStaticArray<T, C>::ezStaticArray(const ezStaticArray<T, C>& rhs) { EZ_ASSERT_DEBUG(this->m_pElements == nullptr, "static arrays should not use m_pElements"); this->m_uiCapacity = C; *this = (ezArrayPtr<const T>)rhs; // redirect this to the ezArrayPtr version } template <typename T, ezUInt32 C> template <ezUInt32 OtherCapacity> ezStaticArray<T, C>::ezStaticArray(const ezStaticArray<T, OtherCapacity>& rhs) { static_assert(OtherCapacity <= C); EZ_ASSERT_DEBUG(this->m_pElements == nullptr, "static arrays should not use m_pElements"); this->m_uiCapacity = C; *this = (ezArrayPtr<const T>)rhs; // redirect this to the ezArrayPtr version } template <typename T, ezUInt32 C> ezStaticArray<T, C>::ezStaticArray(const ezArrayPtr<const T>& rhs) { EZ_ASSERT_DEBUG(this->m_pElements == nullptr, "static arrays should not use m_pElements"); this->m_uiCapacity = C; *this = rhs; } template <typename T, ezUInt32 C> ezStaticArray<T, C>::~ezStaticArray() { this->Clear(); EZ_ASSERT_DEBUG(this->m_pElements == nullptr, "static arrays should not use m_pElements"); } template <typename T, ezUInt32 C> EZ_ALWAYS_INLINE T* ezStaticArray<T, C>::GetStaticArray() { return reinterpret_cast<T*>(m_Data); } template <typename T, ezUInt32 C> EZ_FORCE_INLINE const T* ezStaticArray<T, C>::GetStaticArray() const { return reinterpret_cast<const T*>(m_Data); } template <typename T, ezUInt32 C> EZ_FORCE_INLINE void ezStaticArray<T, C>::Reserve(ezUInt32 uiCapacity) { EZ_IGNORE_UNUSED(uiCapacity); EZ_ASSERT_DEV(uiCapacity <= C, "The static array has a fixed capacity of {0}, cannot reserve more elements than that.", C); // Nothing to do here } template <typename T, ezUInt32 C> EZ_ALWAYS_INLINE void ezStaticArray<T, C>::operator=(const ezStaticArray<T, C>& rhs) { *this = (ezArrayPtr<const T>)rhs; // redirect this to the ezArrayPtr version } template <typename T, ezUInt32 C> template <ezUInt32 OtherCapacity> EZ_ALWAYS_INLINE void ezStaticArray<T, C>::operator=(const ezStaticArray<T, OtherCapacity>& rhs) { *this = (ezArrayPtr<const T>)rhs; // redirect this to the ezArrayPtr version } template <typename T, ezUInt32 C> EZ_ALWAYS_INLINE void ezStaticArray<T, C>::operator=(const ezArrayPtr<const T>& rhs) { ezArrayBase<T, ezStaticArray<T, C>>::operator=(rhs); } template <typename T, ezUInt32 C> EZ_FORCE_INLINE T* ezStaticArray<T, C>::GetElementsPtr() { return GetStaticArray(); } template <typename T, ezUInt32 C> EZ_FORCE_INLINE const T* ezStaticArray<T, C>::GetElementsPtr() const { return GetStaticArray(); }