std::alignment_of
提供:cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
| Defined in header <type_traits>
|
||
| template< class T > struct alignment_of; |
(C + + 11以来) | |
value式によって得られたかのように、型Tの整列要求に一定alignof等しい部材を提供する。 Tが配列型である場合、要素の型の整列要求を返します。.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.
You can help to correct and verify the translation. Click here for instructions.
目次 |
Inherited from std::integral_constant
Member constants
| value [静的] |
alignof(typename std::remove_all_extents<T>::type) (公共の静的メンバ定数) |
Member functions
| operator std::size_t |
std::size_tにオブジェクトは、 value返しに変換します Original: converts the object to std::size_t, returns value The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (パブリックメンバ関数) |
Member types
| タイプ
Original: Type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Definition |
value_type
|
std::size_t
|
type
|
std::integral_constant<std::size_t, value> |
[編集] 可能な実装
template< class T > struct alignment_of : std::integral_constant< std::size_t, alignof(typename std::remove_all_extents<T>::type) > {}; |
[編集] 例
#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:
1 4 8
[編集] も参照してください
| alignof operator | queries alignment requirements of a type (C + + 11以来) |
| (C++11) |
指定されたサイズのタイプのための初期化されていないストレージとして使用するのに適したタイプを定義します Original: defines the type suitable for use as uninitialized storage for types of given size The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (クラステンプレート) |
| (C++11) |
指定されたすべてのタイプのための初期化されていないストレージとして使用するのに適したタイプを定義します Original: defines the type suitable for use as uninitialized storage for all given types The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (クラステンプレート) |
| (C++11) |
他のスカラー型として素晴らしいとアラインメント要件とPOD型 Original: POD type with alignment requirement as great as any other scalar type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (typedefです) |