alignment_of Class
取得型別的的對齊方式。
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>
Namespace: 標準