is_floating_point, classe
Teste si le type est à virgule flottante.
Syntaxe
template <class Ty>
struct is_floating_point;
Paramètres
Ty
Type à interroger.
Notes
Une instance du prédicat de type a la valeur true si le type Ty est un type à virgule flottante ou une cv-qualified
forme d’un type à virgule flottante, sinon il contient false.
Un type à virgule flottante est float
, double
ou long double
.
Exemple
// std__type_traits__is_floating_point.cpp
// compile with: /EHsc
#include <type_traits>
#include <iostream>
struct trivial
{
int val;
};
int main()
{
std::cout << "is_floating_point<trivial> == " << std::boolalpha
<< std::is_floating_point<trivial>::value << std::endl;
std::cout << "is_floating_point<int> == " << std::boolalpha
<< std::is_floating_point<int>::value << std::endl;
std::cout << "is_floating_point<float> == " << std::boolalpha
<< std::is_floating_point<float>::value << std::endl;
return (0);
}
is_floating_point<trivial> == false
is_floating_point<int> == false
is_floating_point<float> == true
Spécifications
Header :<type_traits>
Espace de noms : std
Voir aussi
Commentaires
https://aka.ms/ContentUserFeedback.
Bientôt disponible : Tout au long de 2024, nous allons supprimer progressivement GitHub Issues comme mécanisme de commentaires pour le contenu et le remplacer par un nouveau système de commentaires. Pour plus d’informations, consultezEnvoyer et afficher des commentaires pour