is_polymorphic Class
Test se il tipo presenta una funzione virtuale.
template<class Ty>
struct is_polymorphic;
Parametri
- Ty
Il tipo da eseguire la query.
Note
Un'istanza del predicato del tipo per poter se il tipo Ty è una classe che dichiara o eredita una funzione virtuale, è contenuta in caso contrario false.
Esempio
// std_tr1__type_traits__is_polymorphic.cpp
// compile with: /EHsc
#include <type_traits>
#include <iostream>
struct trivial
{
int val;
};
struct throws
{
throws() throw(int)
{
}
throws(const throws&) throw(int)
{
}
throws& operator=(const throws&) throw(int)
{
}
virtual ~throws()
{
}
int val;
};
int main()
{
std::cout << "is_polymorphic<trivial> == " << std::boolalpha
<< std::is_polymorphic<trivial>::value << std::endl;
std::cout << "is_polymorphic<throws> == " << std::boolalpha
<< std::is_polymorphic<throws>::value << std::endl;
return (0);
}
Requisiti
intestazione: <type_traits>
Spazio dei nomi: deviazione standard