is_const Class
Teste si le type est const.
template<class Ty>
struct is_const;
Paramètres
- Ty
Le type à interroger.
Notes
Une instance du type attribut juge true si Ty est const-qualified.
Exemple
// std_tr1__type_traits__is_const.cpp
// compile with: /EHsc
#include <type_traits>
#include <iostream>
struct trivial
{
int val;
};
int main()
{
std::cout << "is_const<trivial> == " << std::boolalpha
<< std::is_const<trivial>::value << std::endl;
std::cout << "is_const<const trivial> == " << std::boolalpha
<< std::is_const<const trivial>::value << std::endl;
std::cout << "is_const<int> == " << std::boolalpha
<< std::is_const<int>::value << std::endl;
std::cout << "is_const<const int> == " << std::boolalpha
<< std::is_const<const int>::value << std::endl;
return (0);
}
Configuration requise
en-tête : <type_traits>
l'espace de noms : DST