Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
|
#include <aligned_memory_internal.h>
Classes | |
struct | rebind |
Public Member Functions | |
T * | allocate (size_t num_items) |
T * | allocate (size_t n, const void *) |
A version of allocate() that takes a hint; we just ignore the hint. | |
void | deallocate (T *p, size_t) |
Frees memory allocated by allocate(). | |
Definition at line 29 of file aligned_memory_internal.h.
|
inline |
A version of allocate() that takes a hint; we just ignore the hint.
Definition at line 57 of file aligned_memory_internal.h.
|
inline |
Allocates memory for num_items items of type T. The memory must be freed using deallocate(); using it with free() or delete
might cause unexpected behavior when misalignment is used.
Having misalignment_bytes >= alignment_bytes is useless, because all misalignments are equivalent modulo alignment_bytes
. Disallowing it allows us to simplify the code below.
std::aligned_alloc(alignment, size)
requires that size
is a multiple of alignment
, and might return a nullptr when this is not respected. To be safe, we round the number of bytes up to alignment.
Definition at line 33 of file aligned_memory_internal.h.
|
inline |
Frees memory allocated by allocate().
Definition at line 60 of file aligned_memory_internal.h.