nlib
|
A class for obtaining aligned memory. More...
#include "nn/nlib/DynamicAlignedStorage.h"
Public Member Functions | |
errno_t | Init (size_t size, size_t align) noexcept |
Allocates memory. More... | |
void * | Get () noexcept |
Returns a pointer to the allocated region. More... | |
Basic Member Functions | |
constexpr | DynamicAlignedStorage () noexcept |
Instantiates the object with default parameters (default constructor). | |
DynamicAlignedStorage (DynamicAlignedStorage &&rhs) noexcept | |
Instantiates the object (move constructor). This function is useful when using C++11. | |
DynamicAlignedStorage & | operator= (DynamicAlignedStorage &&rhs) noexcept |
Move assignment operator. This function is useful when using C++11. | |
DynamicAlignedStorage (DynamicAlignedStorage &rhs, move_tag) noexcept | |
Corresponds to a move constructor. | |
DynamicAlignedStorage & | assign (DynamicAlignedStorage &rhs, move_tag) noexcept |
Corresponds to a move assignment operator. | |
void | swap (DynamicAlignedStorage &rhs) noexcept |
Swaps objects. More... | |
~DynamicAlignedStorage () noexcept | |
Destructor. | |
A class for obtaining aligned memory.
std::aligned_storage
or alignas
, whether large alignments are supported or not depends on the environment. To use memory with a large alignment, you must allocate memory dynamically. This class is implemented by wrapping nlib_memalign()
for OSs other than Windows and by wrapping _aligned_malloc()
for Windows. Definition at line 24 of file DynamicAlignedStorage.h.
|
inlinenoexcept |
Returns a pointer to the allocated region.
Definition at line 84 of file DynamicAlignedStorage.h.
|
inlinenoexcept |
Allocates memory.
[in] | size | Specifies the size of the region to be allocated. |
[in] | align | Specifies the alignment of the region to be allocated. |
0 | Success. |
EINVAL | The alignment was not a power of two. |
ENOMEM | Memory allocation has failed. |
Definition at line 60 of file DynamicAlignedStorage.h.
|
inlinenoexcept |
Swaps objects.
Definition at line 55 of file DynamicAlignedStorage.h.
© 2012-2017 Nintendo Co., Ltd. All rights reserved.