Difference between revisions of "cpp/memory/align"
From cppreference.com
(→See also: link to language) |
m (Text replace - "/sidebar" to "/navbar") |
||
Line 1: | Line 1: | ||
{{cpp/title|align}} | {{cpp/title|align}} | ||
− | {{cpp/memory/ | + | {{cpp/memory/navbar}} |
{{ddcl | notes={{mark since c++11}} | header=memory | | {{ddcl | notes={{mark since c++11}} | header=memory | | ||
void* align( std::size_t alignment, | void* align( std::size_t alignment, |
Revision as of 13:27, 15 June 2012
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 |
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 |
Return value
The adjusted value of ptr
, or null pointer value if the space provided is too small.
Example
This section is incomplete Reason: no example |
See also
(C++11)(deprecated in C++23) |
defines the type suitable for use as uninitialized storage for types of given size (class template) |