I want to know where to use alignof
operator in c++14
#include <iostream>
struct Empty {};
struct Foo {
int f2;
float f1;
char c;
};
int main()
{
std::cout << "alignment of empty class: " << alignof(int*) << '\n';
std::cout << "sizeof of pointer : " << sizeof(Foo) <<"\n" ;
std::cout << "alignment of char : " << alignof(Foo) << '\n'
std::cout << "sizeof of Foo : " << sizeof(int*) << '\n' ;
}
I would like to know what alignof
does in above program?