C++11 からの alignof でアラインメントを取得 ― 2021年06月12日 11時40分56秒
% cat alignof.cpp.html
// c++ -std=c++11
#include <iostream>
struct double_char
{
double d;
char i;
};
struct short_char
{
short f;
char i;
};
int main()
{
std::cout << alignof( double_char ) << std::endl;
std::cout << alignof( short_char ) << std::endl;
}
実行結果。
% c++ -std=c++11 alignof.cpp
% ./a.out
4
2
次回。
最近のコメント