is_signed Class
,如果类型是带符号整数,测试。
template<class Ty>
struct is_signed;
参数
- Ty
查询的类型。
备注
该类型特性的实例适合,如果类型 Ty 是一个带符号整型或 cv-qualified 带符号的整数类型,否则它包含错误。
示例
// 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
命名空间: std