##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::max_align_t

From cppreference.com
< cpp‎ | types

Defined in header `<cstddef>` |  |
typedef /*implementation-defined*/ max_align_t; |  | (since C++11)

std::max_align_t is a POD type whose alignment requirement is at least as strict (as large) as that of every scalar type.

### [edit] Notes

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 is usually synonymous with the largest scalar type, which is long double on most platforms, and its alignment requirement is either 8 or 16.

### [edit] Example

Run this code

    #include <iostream>
    #include <cstddef>
    int main()
    {
        std::cout << alignof(std::max_align_t) << '\n';
    }

Possible output:

    16

### [edit] See also

alignof operator | queries alignment requirements of a type (since C++11) [edit]
alignment_of (C++11) | obtains the type's alignment requirements (class template) [edit]
is_scalar (C++11) | checks if a type is scalar type (class template) [edit]

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/types/max_align_t&oldid=71412"