std::max_align_t
来自cppreference.com
该页由英文版wiki使用Google Translate机器翻译而来。
该翻译可能存在错误或用词不当。鼠标停留在文本上可以看到原版本。你可以帮助我们修正错误或改进翻译。参见说明请点击这里. |
在头文件 <cstddef> 中定义
|
||
typedef /*implementation-defined*/ max_align_t; |
(C++11 起) | |
std::max_align_t是一个POD类型的对齐要求至少是严格的(大),每标量类型.
原文:
std::max_align_t is a POD type whose alignment requirement is at least as strict (as large) as that of every scalar type.
[编辑] 注释
返回的指针分配的功能,如std::malloc适当的任何对象对齐,这意味着他们至少对齐严格std::max_align_t.
原文:
Pointers returned by allocation functions such as std::malloc are suitably aligned for any object, which means they are aligned at least as strict as std::max_align_t.
std::max_align_t通常是最大的标量类型,这是long double在大多数平台上,并对齐要求是8或16的代名词.....
原文:
std::max_align_t is usually synonymous with the largest scalar type, which is long double on most platforms, and its alignment requirement is either 8 or 16.
[编辑] 示例
#include <iostream> #include <cstddef> int main() { std::cout << alignof(std::max_align_t) << '\n'; }
输出:
16
[编辑] 另请参阅
alignof operator | queries alignment requirements of a type (C++11 起) |
(C++11) |
获取类型的最小对齐字节数 (类模板) |
(C++11) |
检查是否是标量类型 (类模板) |