is_signed Class

 

For the latest documentation on Visual Studio 2017, see Visual Studio 2017 Documentation.

For the latest documentation on Visual Studio 2017, see is_signed Class on docs.microsoft.com. Test if type is signed integer.

template <class Ty>  
struct is_signed;  

Parameters

Ty
The type to query.

An instance of the type predicate holds true if the type Ty is a signed integral type or a cv-qualified signed integral type, otherwise it holds 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);   
    }  
  

is_signed<trivial> == false  
is_signed<int> == true  
is_signed<unsigned int> == false  
is_signed<float> == false  

Header: <type_traits>

Namespace: std

<type_traits>
is_unsigned Class

Show: