aligned_storage (Clase)

Crea un tipo alineado como corresponda.

template<std::size_t Len, std::size_t Align>
    struct aligned_storage {
        typedef aligned-type type;
        };

template<size_t _Len,
size_t _Align = alignment_of<max_align_t>::value>
using aligned_storage_t = typename aligned_storage<_Len, _Align>::type;

Parámetros

  • Len
    Tamaño del objeto.

  • Align
    Alineación del objeto.

Comentarios

El objeto Typedef anidado type es un sinónimo de un tipo POD con alineación Align y tamaño Len. Align debe ser igual a alignment_of<Ty1>::value para un tipo Ty1.

Ejemplo

 

#include <type_traits> 
#include <iostream> 
 
typedef std::aligned_storage<sizeof (int), 
    std::alignment_of<double>::value>::type New_type; 
int main() 
    { 
    std::cout << "alignment_of<int> == " 
        << std::alignment_of<int>::value << std::endl; 
    std::cout << "aligned to double == " 
        << std::alignment_of<New_type>::value << std::endl; 
 
    return (0); 
    } 
 
  

Requisitos

Encabezado: <type_traits>

Espacio de nombres: std

Vea también

Referencia

<type_traits>

alignment_of (Clase)

Otros recursos

miembros de <type_traits>