std::is_abstract

Header: <type_traits>

std::is_abstract is a UnaryTypeTrait.

# Declarations

template< class T >
struct is_abstract;

(since C++11)

# Example

#include <iostream>
#include <type_traits>
 
struct A { int m; };
static_assert(std::is_abstract_v<A> == false);
 
struct B { virtual void foo(); };
static_assert(std::is_abstract_v<B> == false);
 
struct C { virtual void foo() = 0; };
static_assert(std::is_abstract_v<C> == true);
 
struct D : C {};
static_assert(std::is_abstract_v<D> == true);
 
int main() {}

# Defect reports

DRApplied toBehavior as publishedCorrect behavior
LWG 2015C++11the behavior was undefined ifT is an incomplete union typethe base characteristic isstd::false_type in this case

# See also