is_unsigned, classe
Teste si le type est un entier non signé.
Syntaxe
template <class Ty>
struct is_unsigned;
Paramètres
Ty
Type à interroger.
Notes
Une instance du prédicat de type a la valeur true si le type Ty est un type intégral non signé ou un cv-qualified
type intégral non signé, sinon il contient false.
Exemple
// std__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);
}
is_unsigned<trivial> == false
is_unsigned<int> == false
is_unsigned<unsigned int> == true
is_unsigned<float> == false
Spécifications
Header :<type_traits>
Espace de noms : std