Namespaces
Variants
Views
Actions

std::max_align_t

From cppreference.com
< cpp‎ | types
Revision as of 12:31, 8 December 2012 by 83.177.154.38 (Talk)

 
 
 
Type support
Basic types
Fundamental types
Fixed width integer types (C++11)
max_align_t
(C++11)
Numeric limits
C numeric limits interface
Runtime type information
Type traits
Primary 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++11)
(C++14)
Supported operations
Relationships and property queries
(C++11)
(C++11)
(C++11)
(C++11)
Type modifications
(C++11)(C++11)(C++11)
Type transformations
(C++11)
(C++11)
(C++11)
Type trait constants
 

Template:ddcl list begin <tr class="t-dsc-header">

<td>
Defined in header <cstddef>
</td>

<td></td> <td></td> <tr class="t-dcl-sep"><td></td><td></td><td></td></tr>

<tr class="t-dcl ">

<td >
typedef /*implementation-defined*/ max_align_t;
</td>

<td class="t-dcl-nopad"> </td> <td > (since C++11) </td> </tr> Template:ddcl list end

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

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.

Example

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

Possible output:

16

See also

Template:cpp/language/dcl list alignof
obtains the type's alignment requirements
(class template) [edit]
(C++11)
checks if a type is scalar type
(class template) [edit]