is_base_of Class
Bir tür diğerine temel ise sınamaları.
template<class Base, class Derived>
struct is_base_of;
Parametreler
Base
Sınamak için taban sınıf.Derived
Sınamak için türetilmiş bir tür.
Notlar
Bir örneğini türü yüklemi true ise tutan türü Base türü temel sınıftır Derived, aksi takdirde false tutar.
Örnek
// std_tr1__type_traits__is_base_of.cpp
// compile with: /EHsc
#include <type_traits>
#include <iostream>
struct base
{
int val;
};
struct derived
: public base
{
};
int main()
{
std::cout << "is_base_of<base, base> == " << std::boolalpha
<< std::is_base_of<base, base>::value << std::endl;
std::cout << "is_base_of<base, derived> == " << std::boolalpha
<< std::is_base_of<base, derived>::value << std::endl;
std::cout << "is_base_of<derived, base> == " << std::boolalpha
<< std::is_base_of<derived, base>::value << std::endl;
return (0);
}
Gereksinimler
Başlık: <type_traits>
Namespace: std