From 1aa7f12c0f0b6d910d4baef51bb530a819663a3d Mon Sep 17 00:00:00 2001 From: Brett Laptop Date: Thu, 16 Jan 2025 19:47:13 -0500 Subject: [PATCH] fix ptr stuff --- CMakeLists.txt | 2 +- include/blt/std/memory_util.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 76ed3f0..8a1aeb6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.20) include(cmake/color.cmake) -set(BLT_VERSION 3.0.1) +set(BLT_VERSION 3.0.2) set(BLT_TARGET BLT) diff --git a/include/blt/std/memory_util.h b/include/blt/std/memory_util.h index 7ac86e2..861ec51 100644 --- a/include/blt/std/memory_util.h +++ b/include/blt/std/memory_util.h @@ -149,9 +149,10 @@ namespace blt::mem static_assert(std::is_trivially_copyable_v, "Storage type must be trivially copyable!"); 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) { - new (reinterpret_cast(&this->ptr) + 6) Storage{}; + // new (reinterpret_cast(&this->ptr) + 6) Storage{}; } explicit pointer_storage(Ptr* ptr, const Storage& storage): ptr(ptr)