std::align
From cppreference.com
Defined in header <memory>
|
||
void* align( std::size_t alignment,
std::size_t size, |
(since C++11) | |
If it is possible to fit size
bytes of storage aligned by alignment
into the buffer pointed to by ptr
with length space
, the function modifies ptr
to point to the first possible address of such aligned storage and decreases space
by the number of bytes used for alignment. If it is impossible (the buffer is too small), align
does nothing.
Contents |
[edit] Parameters
alignment | - | the desired alignment |
size | - | the size of the storage to be aligned |
ptr | - | pointer to contiguous storage of at least space bytes
|
space | - | the size of the buffer in which to operate |
[edit] Return value
The adjusted value of ptr
, or null pointer value if the space provided is too small.
[edit] Example
This section is incomplete Reason: no example |
[edit] See also
alignof operator | queries alignment requirements of a type (since C++11) |
alignas specifier | specifies that the storage for the variable should be aligned by specific amount (C++11) |
(C++11)
|
defines the type suitable for use as uninitialized storage for types of given size (class template) |