is_abstract Class

 

For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.

Tests if type is abstract class.

template <class Ty>  
struct is_abstract;  

Parameters

Ty
The type to query.

An instance of the type predicate holds true if the type Ty is a class that has at least one pure virtual function, otherwise it holds false.

// std_tr1__type_traits__is_abstract.cpp   
// compile with: /EHsc   
#include <type_traits>   
#include <iostream>   
  
struct trivial   
    {   
    int val;   
    };   
  
struct abstract   
    {   
    virtual int val() = 0;   
    };   
  
int main()   
    {   
    std::cout << "is_abstract<trivial> == " << std::boolalpha   
        << std::is_abstract<trivial>::value << std::endl;   
    std::cout << "is_abstract<abstract> == " << std::boolalpha   
        << std::is_abstract<abstract>::value << std::endl;   
  
    return (0);   
    }  
  

is_abstract<trivial> == false  
is_abstract<abstract> == true  

Header: <type_traits>

Namespace: std

<type_traits>
is_polymorphic Class

Show: