diff --git a/source/coral.cpp b/source/coral.cpp index e8bdc5d..e31a0e8 100755 --- a/source/coral.cpp +++ b/source/coral.cpp @@ -223,72 +223,6 @@ export namespace coral { } } -/** - * Allocates and initializes a type of `requested_size` in `buffer`, returning its base pointer. As a result of - * accepting a pre-allocated buffer, invocation does not allocate any dynamic memory. - * - * *Note*: passing an `buffer` smaller than `requested_size` will result in safety-checked behavior. - */ -export void * operator new(coral::usize requested_size, coral::slice const & buffer) { - if (buffer.length < requested_size) coral::unreachable(); - - return buffer.pointer; -} - -/** - * Allocates and initializes a series of types at `requested_size` in `buffer`, returning the base pointer. As a result - * of accepting a pre-allocated buffer, invocation does not allocate any dynamic memory. - * - * *Note*: passing an `buffer` smaller than `requested_size` will result in safety-checked behavior. - */ -export void * operator new[](coral::usize requested_size, coral::slice const & buffer) { - if (buffer.length < requested_size) coral::unreachable(); - - return buffer.pointer; -} - -/** - * Attempts to allocate and initialize a type of `requested_size` using `allocator`. - * - * *Note*: If the returned address is a non-`nullptr`, it should be deallocated prior to program exit. This may be - * achieved through either [coral::allocator::deallocate] or implementation-specific allocator functionality. - */ -export [[nodiscard]] void * operator new(coral::usize requested_size, coral::allocator & allocator) { - return allocator.reallocate(nullptr, requested_size); -} - -/** - * Attempts to allocate and initialize a series of types of `requested_size` using `allocator`. - * - * *Note*: If the returned address is a non-`nullptr`, it should be deallocated prior to program exit. This may be - * achieved through either [coral::allocator::deallocate] or implementation-specific allocator functionality. - */ -export [[nodiscard]] void * operator new[](coral::usize requested_size, coral::allocator & allocator) { - return allocator.reallocate(nullptr, requested_size); -} - -/** - * If `pointer` is a non-`nullptr` value, the referenced memory will be deallocated using `allocator`. Otherwise, the - * function has no side-effects. - * - * *Note*: passing a `pointer` value that was not allocated by `allocator` will result in erroneous behavior defined by - * the [coral::allocator] implementation. - */ -export void operator delete(void * pointer, coral::allocator & allocator) { - return allocator.deallocate(pointer); -} - -/** - * If `pointer` is a non-`nullptr` value, the referenced memory block will be deallocated using `allocator`. Otherwise, - * the function has no side-effects. - * - * *Note*: passing a `pointer` value that was not allocated by `allocator` will result in erroneous behavior defined by - * the [coral::allocator] implementation. - */ -export void operator delete[](void * pointer, coral::allocator & allocator) { - return allocator.deallocate(pointer); -} - // Wrapper types. export namespace coral { template concept function_pointer =