Namespaces
Variants
Views
Actions

C++ concepts: TriviallyCopyable

From cppreference.com
< cpp‎ | concept
 
 
 

[edit] Requirements

  • Every copy constructor is Trivial or deleted (since C++14)
  • Every move constructor is Trivial or deleted (since C++14)
  • Every copy assignment operator is Trivial or deleted (since C++14)
  • Every move assignment operator is Trivial or deleted (since C++14)
  • at least one copy constructor, move constructor, copy assignment operator, or move assignment operator is non-deleted
(since C++14)
  • Trivial non-deleted (since C++14) destructor

This implies that the class has no virtual functions or virtual base classes.

Scalar types and arrays of TriviallyCopyable objects are TriviallyCopyable as well, as well as the const-qualified (but not volatile-qualified) versions of such types.

[edit] Defect reports

The following behavior-changing defect reports were applied retroactively to previously published C++ standards.

DR Applied to Behavior as published Correct behavior
CWG 1734 C++14 C++03 POD with deleted non-trivial assignment was not trivial deleted ctors/operators allowed

[edit] See also

checks if a type is trivially copyable
(class template) [edit]