Abstract class defining the interface of a memory resource.
More...
#include <memory_resource.hpp>
|
|
using | pointer = void * |
| | alias for ease of naming
|
| |
|
using | const_pointer = const void * |
| | alias for ease of naming
|
| |
Abstract class defining the interface of a memory resource.
◆ allocate()
Pure virtual function for a common allocation interface.
- Precondition
bytes >= 0, otherwise UB
-
alignment >= 0, otherwise UB
- Parameters
-
| [in] | bytes | The size of the allocation in bytes |
| [in] | alignment | The alignment of the allocation in bytes |
- Returns
- A valid pointer to a memory chunk or nullptr if the allocation failed
Implemented in caramel::global_resource.
◆ deallocate()
| virtual void caramel::memory_resource::deallocate |
( |
gsl::not_null< pointer > |
ptr, |
|
|
count_t |
bytes, |
|
|
align_t |
alignment |
|
) |
| |
|
pure virtualnoexcept |
Pure virtual function for a common deallocation interface.
- Precondition
bytes >= 0, otherwise UB
-
alignment >= 0, otherwise UB
- Parameters
-
| [in] | ptr | The starting location of the memory chunk |
| [in] | bytes | The size of the allocation in bytes |
| [in] | alignment | The alignment of the allocation in bytes |
Implemented in caramel::global_resource.
◆ is_equal()
| virtual auto caramel::memory_resource::is_equal |
( |
const memory_resource & |
other | ) |
const -> bool |
|
pure virtualnoexcept |
Pure virtual function for a common comparison interface.
- Parameters
-
- Returns
- True if both memory_resources are considered equal, otherwise false
Implemented in caramel::global_resource.
◆ operator==()
| auto caramel::memory_resource::operator== |
( |
const memory_resource & |
rhs | ) |
const -> bool |
Check if two memory_resources are equal.
Use the virtual is_equal function to compare if two memory_resources are equal like so: this == &rhs or is_equal(rhs).
- Parameters
-
- Returns
The documentation for this class was generated from the following files: