Objects of a type with this trait can be copied using memcpy. After such a bitwise copy, both the original and the copy are valid. Classes with this trait are assumed to have trivial (no-op) destructors and are assumed to be bitwise moveable (see the TypeTraitBitwiseMoveable trait). Undefined behavior may result if this trait is assigned to a type that allocates memory or other resources, uses virtual inheritance, or places pointers to itself within other data structures. Also, objects of a type with this trait can be destroyed by a no-op, i.e., not invoking the destructor, although it is safe to write zeros into the memory footprint of the object.
Declared in <bslalg_typetraitbitwisecopyable.h>
struct TypeTraitBitwiseCopyable;
| Name | Description |
|---|---|
Metafunction | This class template ties the bslalg::TypeTraitBitwiseCopyable trait tag to the bslmf::IsBitwiseCopyable trait metafunction. |
NestedTraitDeclaration | This class template ties the bslalg::TypeTraitBitwiseCopyable trait tag to the bsl::is_trivially_copyable trait metafunction. |