std::align
来自cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
| Defined in header <memory>
|
||
| void* align( std::size_t alignment, std::size_t size, |
(C++11 起) | |
如果它是可能的,以适应
size字节对齐成指向的缓冲区长度alignment由ptrspace存储,函数修改ptr指向的第一可能的地址,例如对齐的存储,并降低由用于对准的字节数的space 。如果这是不可能的(缓冲区太小),align一无所有Original:
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.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
目录 |
[编辑] 参数
| alignment | - | 所需的对齐方式
Original: the desired alignment The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
| size | - | 大小的存储要对齐
Original: the size of the storage to be aligned The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
| ptr | - | 相连存储的至少
space字节指针Original: pointer to contiguous storage of at least space bytesThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
| space | - | 要在其中操作的缓冲区的大小
Original: the size of the buffer in which to operate The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[编辑] 返回值
ptr,或空指针值的调整值,如果所提供的空间太小.Original:
The adjusted value of
ptr, or null pointer value if the space provided is too small.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[编辑] 为例
| 本节是不完整的 原因: no example |
[编辑] 另请参阅
| alignof operator | queries alignment requirements of a type (C++11 起) |
| alignas说明 | 指定的变量的存储空间应保持一致的具体数额(C++11)
Original: specifies that the storage for the variable should be aligned by specific amount (C++11) The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
| (C++11) |
定义的类型适合用作未初始化的存储类型的给定尺寸 Original: defines the type suitable for use as uninitialized storage for types of given size The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |