fix ptr stuff

v2
Brett 2025-01-16 19:47:13 -05:00
parent 41c6dea002
commit 1aa7f12c0f
2 changed files with 3 additions and 2 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.20) cmake_minimum_required(VERSION 3.20)
include(cmake/color.cmake) include(cmake/color.cmake)
set(BLT_VERSION 3.0.1) set(BLT_VERSION 3.0.2)
set(BLT_TARGET BLT) set(BLT_TARGET BLT)

View File

@ -149,9 +149,10 @@ namespace blt::mem
static_assert(std::is_trivially_copyable_v<Storage>, "Storage type must be trivially copyable!"); static_assert(std::is_trivially_copyable_v<Storage>, "Storage type must be trivially copyable!");
static_assert(alignof(Storage) <= 2, "Storage type must have an alignment of 2 or less!"); static_assert(alignof(Storage) <= 2, "Storage type must have an alignment of 2 or less!");
// we should not default initialize storage when only providing a pointer, mostly because we will want to take already stored pointers and use them.
explicit pointer_storage(Ptr* ptr): ptr(ptr) explicit pointer_storage(Ptr* ptr): ptr(ptr)
{ {
new (reinterpret_cast<char*>(&this->ptr) + 6) Storage{}; // new (reinterpret_cast<char*>(&this->ptr) + 6) Storage{};
} }
explicit pointer_storage(Ptr* ptr, const Storage& storage): ptr(ptr) explicit pointer_storage(Ptr* ptr, const Storage& storage): ptr(ptr)