This stateless allocator performs all of its allocation calls using raw calls to 'malloc', and frees memory with 'free'.
More...
#include <malloc_allocator.hpp>
|
using | default_alignment = std::integral_constant< std::size_t, alignof(std::max_align_t)> |
|
This stateless allocator performs all of its allocation calls using raw calls to 'malloc', and frees memory with 'free'.
Any alignment requests are ignored
- Satisfies
- Allocator
- Satisfies
- Stateless
Definition at line 59 of file malloc_allocator.hpp.
◆ malloc_allocator() [1/2]
◆ malloc_allocator() [2/2]
bit::memory::malloc_allocator::malloc_allocator |
( |
const malloc_allocator & |
other | ) |
|
|
defaultnoexcept |
◆ deallocate()
void bit::memory::malloc_allocator::deallocate |
( |
owner< void *> |
p, |
|
|
std::size_t |
size |
|
) |
| |
Deallocates a pointer p
with the allocation size of size
.
- Parameters
-
p | the pointer to deallocate |
size | the size to deallocate |
◆ info()
Gets the info about this allocator.
This defaults to 'malloc_allocator'. Use a named_malloc_allocator to override this
- Returns
- the info for this allocator
◆ operator=() [1/2]
Move-assigns a malloc_allocator from another allocator.
- Parameters
-
- Returns
- reference to
(*this)
◆ operator=() [2/2]
Copy-assigns a malloc_allocator from another allocator.
- Parameters
-
- Returns
- reference to
(*this)
◆ try_allocate()
owner<void*> bit::memory::malloc_allocator::try_allocate |
( |
std::size_t |
size, |
|
|
std::size_t |
align |
|
) |
| |
|
noexcept |
Attempts to allocate memory of size size
, returning nullptr on failure.
The alignment is ignored for calls to this allocator. The alignment is always guaranteed to be at least alignof(std::max_align_t)
- Parameters
-
size | the size of this allocation |
align | the requested alignment (ignored) |
- Returns
- the allocated pointer
The documentation for this class was generated from the following file: