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