make fixed size matrices and arrays trivially_copy_constructible and trivially_move_constructible

Reference issue

Related to #1855

What does this implement/fix?

https://godbolt.org/z/c87PWrKTb

Our copy and move constructors are already trivial but do not satisfy the (strict) requirements for std::is_trivially_copy_constructible and std::is_trivially_move_constructible. In theory, these characteristics allow the compiler to treat these operations as if the matrices and arrays are PODs, which sounds useful. In clang, these characteristics allow it to satisfy __is_trivially_relocatable.

Implicitly declared / explicitly defaulted copy constructors already copy their class members, and explicitly copying them in an initializer statement serves no purpose other than to invalidate their triviality. Implicit / default constructors are also noexcept (when its possible). I'm not sure if constexpr and inline are necessary, but I don't see the harm either.

Making these classes std::is_trivially_copyable is a bigger task as all our assignments (e.g. EigenBase<Derived>, MatrixBase<Derived>, and so on) would have to comply.

Additional information

Edited by Charles Schlosser

Merge request reports

Loading