18 virtual void*
allocate(
size_t bytes_count) = 0;
23 virtual void deallocate(
void* p,
size_t n) = 0;
28 template <
class AllocatorImpl>
32 return static_cast<AllocatorImpl*
>(
this)->allocate_impl(bytes_count);
37 static_cast<AllocatorImpl*
>(
this)->deallocate_impl(p, n);
43 void* allocate_impl(
size_t bytes_count) {
47 void deallocate_impl(
void* p,
size_t n) {
Base class for custom memory allocator.
Definition: allocator.hpp:12
virtual void deallocate(void *p, size_t n)=0
Deallocate memory.
Definition: eltwise-add-mod.hpp:8
virtual void * allocate(size_t bytes_count)=0
Allocates byte_count bytes of memory.
void * allocate(size_t bytes_count) override
Override interface and delegate implementation to AllocatorImpl.
Definition: allocator.hpp:31
virtual ~AllocatorBase() noexcept
Definition: allocator.hpp:13
#define HEXL_UNUSED(x)
Definition: defines.hpp:13
Helper memory allocation struct which delegates implementation to AllocatorImpl.
Definition: allocator.hpp:29
void deallocate(void *p, size_t n) override
Override interface and delegate implementation to AllocatorImpl.
Definition: allocator.hpp:36