The Wayback Machine - https://web.archive.org/web/20210920030352/https://en.cppreference.com/w/cpp/types/max_align_t
Namespaces
Variants
Views
Actions

std::max_align_t

From cppreference.com
< cpp‎ | types
 
 
Utilities library
General utilities
Relational operators (deprecated in C++20)
Integer comparison functions
(C++20)(C++20)(C++20)   
(C++20)
Swap and type operations
(C++14)
(C++11)

(C++11)
(C++11)
(C++17)
Common vocabulary types
(C++11)
(C++17)
(C++17)
(C++17)
(C++11)
(C++17)

Elementary string conversions
(C++17)
(C++17)

Stacktrace
 
Type support
Basic types
Fundamental types
Fixed width integer types (C++11)
max_align_t
(C++11)
(C++17)
Numeric limits
C numeric limits interface
Runtime type information
Type traits
Type categories
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
Type properties
(C++11)
(C++11)
(C++14)
(C++11)
(C++11)(until C++20)
(C++11)(deprecated in C++20)
(C++11)
Type trait constants
Metafunctions
(C++17)
Constant evaluation context
Supported operations
Relationships and property queries
Type modifications
(C++11)(C++11)(C++11)
Type transformations
(C++11)
(C++11)
(C++17)
(C++11)(until C++20)(C++17)
 
Defined in header <cstddef>
typedef /*implementation-defined*/ max_align_t;
(since C++11)

std::max_align_t is a trivial standard-layout 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 strictly 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

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

Possible output:

16

[edit] See also

alignof operator(C++11) queries alignment requirements of a type[edit]
obtains the type's alignment requirements
(class template) [edit]
(C++11)
checks if a type is a scalar type
(class template) [edit]
C documentation for max_align_t