#pragma once #include "gp_config.hpp" #include "gp/exception.hpp" #include // XXX: THIS FILE SHOULD BE REMOVED, AS SHOULD ALL DEPENDENCIES ON THE C-ALLOCATOR AS IS /* namespace gp{ template> class default_memory_allocator { public: using pointer_type = T*; using reference_type = T&; using const_pointer_type = const T*; using const_reference_type = const T&; pointer_type allocate(size_t sz) { return reinterpret_cast (gp_config::memory_module::memory_allocator(sizeof(T) * sz)); } void deallocate(pointer_type ptr) { gp_config::memory_module::memory_deallocator(ptr); } template pointer_type construct(pointer_type ptr, params... args) { new(ptr) T(args...); return ptr; } void destroy(pointer_type v) { v->~T(); } }; } void* operator new(size_t sz) { auto ptr = gp_config::memory_module::memory_allocator(sz); if constexpr (gp_config::has_exceptions) { if(!ptr) { throw gp::bad_alloc{}; } } return ptr; } void operator delete (void* ptr) noexcept { gp_config::memory_module::memory_deallocator(ptr); } */