From 27fb68da6e454fe9a851835ce244e4c26625287e Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Mon, 30 May 2022 09:45:17 -0600 Subject: [PATCH] Document what it means for a type to be trivially copyable. --- include/deal.II/base/utilities.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/deal.II/base/utilities.h b/include/deal.II/base/utilities.h index 721d450934..8a39e58a50 100644 --- a/include/deal.II/base/utilities.h +++ b/include/deal.II/base/utilities.h @@ -597,6 +597,20 @@ namespace Utilities * this by providing a type which the present function packs into an * empty output buffer, given that many deal.II functions send objects * only after calling pack() to serialize them. + * + * In several of the special cases above, the `std::is_trivially_copyable` + * property is important, see + * https://en.cppreference.com/w/cpp/types/is_trivially_copyable . + * For a type `T` to satisfy this property essentially means that an object + * `t2` of this type can be initialized by copying another object `t1` + * bit-by-bit into the memory space of `t2`. In particular, this is the case + * for built-in types such as `int`, `double`, or `char`, as well as + * structures and classes that only consist of such types and that have + * neither user-defined constructors nor `virtual` functions. In practice, + * and together with the fact that vectors and vector-of-vectors of these + * types are also special-cased, this covers many of the most common kinds of + * messages one sends around with MPI or one wants to serialize (the two + * most common use cases for this function). */ template size_t -- 2.39.5