is_unsigned 類別
測試,如果型別是不帶正負號的整數。
template<class Ty>
struct is_unsigned;
參數
- Ty
查詢的型別。
備註
這個型別述詞的執行個體之型別,則 Ty 是不帶正負號的整數類資料型別或 cv-qualified 不帶正負號的整數型別,否則它保留 false。
範例
// std_tr1__type_traits__is_unsigned.cpp
// compile with: /EHsc
#include <type_traits>
#include <iostream>
struct trivial
{
int val;
};
int main()
{
std::cout << "is_unsigned<trivial> == " << std::boolalpha
<< std::is_unsigned<trivial>::value << std::endl;
std::cout << "is_unsigned<int> == " << std::boolalpha
<< std::is_unsigned<int>::value << std::endl;
std::cout << "is_unsigned<unsigned int> == " << std::boolalpha
<< std::is_unsigned<unsigned int>::value << std::endl;
std::cout << "is_unsigned<float> == " << std::boolalpha
<< std::is_unsigned<float>::value << std::endl;
return (0);
}
需求
標題: <type_traits>
命名空間: std