alignof operator (C++11 feature)

From Cppreference

Jump to: navigation, search

Queries alignment requirements of a type

Contents

[edit] Syntax

alignof( type )

Returns an object of type std::size_t.

[edit] Explanation

Returns alignment in bytes required for any instance of the given type.

If the type is reference type, the operator returns the alignment of referenced type; if the type is array type, alignment requirement of the element type is returned.

[edit] Keywords

alignof

[edit] Example

[edit] See also

sizeof operator