From 58858297fd73602cfb7507ce23b0b9e3d9ded2be Mon Sep 17 00:00:00 2001 From: Ellie Hermaszewska Date: Tue, 25 Apr 2023 23:21:06 +0800 Subject: Bump glm and stb + small neatenings (#2831) * bump glm to fix c++20 warnings * bump stb_image to fix c++20 warnings * Use static_assert for SLANG_COMPILE_TIME_ASSERT * Remove uses of deprecated is_pod * Remove bit operations between different enums --- source/core/slang-allocator.h | 34 +++++----------------------------- 1 file changed, 5 insertions(+), 29 deletions(-) (limited to 'source/core/slang-allocator.h') diff --git a/source/core/slang-allocator.h b/source/core/slang-allocator.h index bc1b880f8..8942f993b 100644 --- a/source/core/slang-allocator.h +++ b/source/core/slang-allocator.h @@ -62,34 +62,6 @@ namespace Slang } }; - // Helper utilties for calling allocators. - template - class Initializer; - - template - class Initializer - { - public: - static void initialize(T* buffer, Index size) - { - for (Index i = 0; i < size; i++) - new (buffer + i) T(); - } - }; - template - class Initializer - { - public: - static void initialize(T* buffer, Index size) - { - SLANG_UNUSED(buffer); - SLANG_UNUSED(size); - // It's pod so no initialization required - //for (int i = 0; i < size; i++) - // new (buffer + i) T; - } - }; - template class AllocateMethod { @@ -98,7 +70,11 @@ namespace Slang { TAllocator allocator; T* rs = (T*)allocator.allocate(count * sizeof(T)); - Initializer::value>::initialize(rs, count); + if (!std::is_trivially_constructible::value) + { + for (Index i = 0; i < count; i++) + new (rs + i) T(); + } return rs; } static inline void deallocateArray(T* ptr, Index count) -- cgit v1.2.3