FieldVector<T, ...> should be trivially copyable for trivially copyable T
I think FieldVector<T, ...>
should be a trivially copyable type if T
is trivially copyable. That allows to copy it with memcpy
(or MPI communication functions which should have similar requirements).
For trivial T
, FieldVector<T, ...>
should also be a trivial type. This just requires a trivial default constructor in additional to the requirements of a trivially copyable type.
This would also address this warning when building dune-grid:
dune-grid/dune/grid/uggrid/uglbgatherscatter.hh:19:15: warning:
'void* memcpy(void*, const void*, size_t)' writing to an object of type
'class Dune::FieldVector<double, 2>' with no trivial copy-assignment; use
copy-assignment or copy-initialization instead [-Wclass-memaccess]
Edited by Ansgar Burchardt