std::aligned_union

From Cppreference

Jump to: navigation, search
Defined in header <type_traits>

template< std::size_t Len, class... Types >
struct aligned_union;
(C++11 feature)

Provides the member typedef type, which is a POD type suitable for use as uninitialized storage, correctly aligned for an object of any of the types listed in Types. The size of the storage is at least Len. std::aligned_union also determines the strictest (largest) alignment requirement among all Types and makes it available as the constant alignment_value.

Contents

[edit] Member types

Name Definition
type the POD type suitable for storage of any type from Types

[edit] Member constants

alignment_value the strictest alignment requirement of all Types
(public static member constant)

[edit] Example

[edit] See also

alignment_of (C++11)
obtains the type's alignment requirements
(class template)
aligned_storage (C++11)
defines the type suitable for use as uninitialized storage for types of given size
(class template)