std::is_abstract
Min standard notice:
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
| DR | Applied to | Behavior as published | Correct behavior |
|---|---|---|---|
| LWG 2015 | C++11 | the behavior was undefined ifT is an incomplete union type | the base characteristic isstd::false_type in this case |