alignment_of クラス
更新 : 2007 年 11 月
型のアライメントを取得します。
template<class Ty>
struct alignment_of;
パラメータ
- Ty
照会する型。
解説
この型クエリは、型 Ty のアライメントの値を保持します。
使用例
// std_tr1__type_traits__alignment_of.cpp
// compile with: /EHsc
#include <type_traits>
#include <iostream>
typedef std::tr1::aligned_storage<sizeof (int),
std::tr1::alignment_of<double>::value>::type New_type;
int main()
{
std::cout << "alignment_of<int> == "
<< std::tr1::alignment_of<int>::value << std::endl;
std::cout << "aligned to double == "
<< std::tr1::alignment_of<New_type>::value << std::endl;
return (0);
}
alignment_of<int> == 4
aligned to double == 8
必要条件
ヘッダー : <type_traits>
名前空間 : std::tr1