次の方法で共有


alignment_of クラス

型のアライメントを取得します。

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::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); 
    } 
 
  

必要条件

ヘッダー : <type_traits>

名前空間: std

参照

関連項目

<type_traits>

aligned_storage クラス

その他の技術情報

<type_traits> メンバー