]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Document what it means for a type to be trivially copyable. 13854/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Mon, 30 May 2022 15:45:17 +0000 (09:45 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Mon, 30 May 2022 15:45:17 +0000 (09:45 -0600)
include/deal.II/base/utilities.h

index 721d450934a0a2eed2287b4354d58f2c108b530c..8a39e58a50da18edcd5a62ec54e2dff4e1e8b4c7 100644 (file)
@@ -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 <typename T>
   size_t

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.