push because weather

thread
Brett 2024-06-25 12:21:09 -04:00
parent 6b86f83d61
commit 7a558f1cc1
3 changed files with 23 additions and 3 deletions

View File

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.25)
project(blt-gp VERSION 0.0.30)
project(blt-gp VERSION 0.0.31)
option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF)
option(ENABLE_UBSAN "Enable the ub sanitizer" OFF)

View File

@ -83,7 +83,7 @@ namespace blt::gp
if constexpr (sizeof...(Args) > 0)
{
(add_non_context_argument<Args>(), ...);
(add_non_context_argument<Args>(operator_id), ...);
}
argc_t argc;

View File

@ -41,6 +41,7 @@ namespace blt::gp
template<typename T>
void push(T&& value)
{
static_assert(std::is_trivially_copyable_v<T> && "Type must be bitwise copyable!");
using NO_REF_T = std::remove_reference_t<T>;
auto ptr = allocate_bytes<T>();
head->metadata.offset = static_cast<blt::u8*>(ptr) + aligned_size<T>();
@ -139,7 +140,26 @@ namespace blt::gp
stack_allocator() = default;
stack_allocator(const stack_allocator& copy) = delete;
stack_allocator(const stack_allocator& copy)
{
head = nullptr;
block* list_itr = nullptr;
// start at the beginning of the list
block* current = copy.head;
while (current != nullptr)
{
list_itr = current;
current = current->metadata.prev;
}
// copy all the blocks
while (list_itr != nullptr)
{
push_block(list_itr->metadata.size);
std::memcpy(head->buffer, list_itr->buffer, list_itr->storage_size());
list_itr = list_itr->metadata.next;
}
}
stack_allocator& operator=(const stack_allocator& copy) = delete;