std::alignment_of - cppreference.com
Da cppreference.com.
|
|
Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate. La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
<metanoindex/>
<tbody> </tbody>
| Elemento definito nell'header <type_traits> |
||
|
|
(dal C++11) | |
Fornisce il membro costante value uguale al valore allineamento del T tipo, come se ottenuto da un'espressione alignof. Se T è un tipo di matrice, restituisce i requisiti di allineamento del tipo di elemento.
Original:
Provides the member constant value equal to the alignment requirement of the type T, as if obtained by an alignof expression. If T is an array type, returns the alignment requirements of the element type.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Inherited from std::integral_constant
Member constants
alignof(typename std::remove_all_extents<T>::type) (pubblico membro statico costante) | |
Member functions
converte l'oggetto in Original: converts the object to The text has been machine-translated via Google Translate. (metodo pubblico) | |
Member types
Tipo Original: Type The text has been machine-translated via Google Translate. |
Definition |
value_type
|
std::size_t
|
type
|
std::integral_constant<std::size_t, value>
|
Possibile implementazione
template< class T > struct alignment_of : std::integral_constant< std::size_t, alignof(typename std::remove_all_extents<T>::type) > {};
Esempio
#include <iostream> #include <type_traits> class A {}; int main() { std::cout << std::alignment_of<A>::value << '\n'; std::cout << std::alignment_of<int>::value << '\n'; std::cout << std::alignment_of<double>::value << '\n'; }
Output:
Vedi anche
| alignof operator | queries alignment requirements of a type (dal C++11) [modifica] |
(C++11) |
definisce il tipo idoneo all'uso come memoria non inizializzato per tipi di dimensione data Original: defines the type suitable for use as uninitialized storage for types of given size The text has been machine-translated via Google Translate. (classe template) [modifica] |
(C++11) |
definisce il tipo adatto per l'uso come memoria non inizializzata per tutti i tipi di dati Original: defines the type suitable for use as uninitialized storage for all given types The text has been machine-translated via Google Translate. (classe template) [modifica] |
(C++11) |
Tipo di POD con il requisito di allineamento così grande come qualsiasi altro scalare Original: POD type with alignment requirement as great as any other scalar type The text has been machine-translated via Google Translate. (typedef) [modifica] |