From 41c6dea00279c9e5b3df6105124ffd95da05a316 Mon Sep 17 00:00:00 2001
From: Brett Laptop <tri11paragon@tpgc.me>
Date: Thu, 16 Jan 2025 19:33:12 -0500
Subject: [PATCH] ptr stuff seems to wrok

---
 CMakeLists.txt                |  2 +-
 include/blt/std/memory_util.h | 25 +++++++++++++++++++++++++
 libraries/parallel-hashmap    |  2 +-
 3 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 19b30f5..76ed3f0 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.0)
+set(BLT_VERSION 3.0.1)
 
 set(BLT_TARGET BLT)
 
diff --git a/include/blt/std/memory_util.h b/include/blt/std/memory_util.h
index 1f7cd7e..7ac86e2 100644
--- a/include/blt/std/memory_util.h
+++ b/include/blt/std/memory_util.h
@@ -146,9 +146,34 @@ namespace blt::mem
     struct pointer_storage
     {
         static_assert(sizeof(Storage) * CHAR_BIT <= 16, "Storage type max size is 16 bits");
+        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!");
 
         explicit pointer_storage(Ptr* ptr): ptr(ptr)
         {
+            new (reinterpret_cast<char*>(&this->ptr) + 6) Storage{};
+        }
+
+        explicit pointer_storage(Ptr* ptr, const Storage& storage): ptr(ptr)
+        {
+            new (reinterpret_cast<char*>(&this->ptr) + 6) Storage{storage};
+        }
+
+        explicit pointer_storage(Ptr* ptr, Storage&& storage): ptr(ptr)
+        {
+            new (reinterpret_cast<char*>(&this->ptr) + 6) Storage{std::move(storage)};
+        }
+
+        Storage& storage()
+        {
+            auto offset_ptr = reinterpret_cast<char*>(&this->ptr) + 6;
+            return *std::launder(reinterpret_cast<Storage*>(offset_ptr));
+        }
+
+        const Storage& storage() const
+        {
+            const auto offset_ptr = reinterpret_cast<char const*>(&this->ptr) + 6;
+            return *std::launder(reinterpret_cast<Storage const*>(offset_ptr));
         }
 
         Ptr* get()
diff --git a/libraries/parallel-hashmap b/libraries/parallel-hashmap
index 8a889d3..d88c5e1 160000
--- a/libraries/parallel-hashmap
+++ b/libraries/parallel-hashmap
@@ -1 +1 @@
-Subproject commit 8a889d3699b3c09ade435641fb034427f3fd12b6
+Subproject commit d88c5e15079047777b418132ece5879e7c9aaa2b