26 alignment = std::max(alignment,
sizeof(
void*));
28 const int err = posix_memalign(&ptr, alignment, size);
30 throw std::runtime_error(strerror(err));
33 void *ptr = malloc(size);
34 if (ptr ==
nullptr) [[unlikely]] {
35 const auto errsv = errno;
36 throw std::runtime_error(strerror(errsv));
std::enable_if_t< not std::is_void_v< T >, T * > allocate()
Allocate space for a single entity of type T that is aligned according to Ts alignment requirement.
void deallocate(void *ptr, size_type size)
Deallocate the allocation at ptr of size size.
This allocator serves allocations using malloc/free.
void deallocate(void *ptr, size_type size)
Deallocate the allocation at ptr of size size.
void * allocate(size_type size, size_type alignment=0)
Allocate size bytes aligned to alignment.