This stateless allocator performs all of its allocation calls using raw calls to 'new', and frees memory with 'delete'.
More...
#include <new_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 'new', and frees memory with 'delete'.
Any alignment requests are ignored
- Satisfies
- Allocator
- Satisfies
- Stateless
Definition at line 59 of file new_allocator.hpp.
◆ new_allocator() [1/2]
bit::memory::new_allocator::new_allocator |
( |
new_allocator && |
other | ) |
|
|
defaultnoexcept |
Move-constructs a new_allocator from another allocator.
- Parameters
-
◆ new_allocator() [2/2]
bit::memory::new_allocator::new_allocator |
( |
const new_allocator & |
other | ) |
|
|
defaultnoexcept |
Copy-constructs a new_allocator from another allocator.
- Parameters
-
◆ deallocate()
void bit::memory::new_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 new_allocator from another allocator.
- Parameters
-
- Returns
- reference to
(*this)
◆ operator=() [2/2]
Copy-assigns a new_allocator from another allocator.
- Parameters
-
- Returns
- reference to
(*this)
◆ try_allocate()
owner<void*> bit::memory::new_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: