Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.


template<class T>
struct is_trivially_copyable
    : true_type-or-false_type { };

Inherits: If T is a (possibly cv-qualified) type that is trivially copyable then inherits from true_type, otherwise inherits from false_type.

Compiler Compatibility: This trait is implemented as the conjunction of has_trivial_copy, has_trivial_assign, and has_trivial_destructor.

Header: #include <boost/type_traits/is_trivially_copyable.hpp>


is_trivially_copyable<int> inherits from true_type.

is_trivially_copyable<const int> inherits from false_type.

is_trivially_copyable<char*>::type is the type true_type.

is_trivially_copyable<int(*)(long)>::value is an integral constant expression that evaluates to true.

is_trivially_copyable<MyClass>::value is an integral constant expression that evaluates to false.

is_trivially_copyable<T>::value_type is the type bool.