FieldMatrix size methods not constexpr
When trying to compile
static_assert(mat.mat_cols() == vec.size(), "");
for FieldMatrix mat
and FieldVector vec
gcc-5 failed and reported that mat_cols()
is not constexpr since FieldMatrix
lacks a constexpr constructor. Compilation failed as well with clang-6, but succeeded with gcc-7.
From dune/common/fmatrix.hh:173
constexpr size_type mat_cols() const { return COLS; }
Since this is a member function it implicitly takes a this
-argument of a non-literal type FieldMatrix
and thus cannot be constexpr.
FieldVector
's size method works fine because its constructor is constexpr.
dune/common/fvector.hh:112
//! Constructor making default-initialized vector
constexpr FieldVector()
: _data{{}}
{}
Possible solutions:
- Make
FieldMatrix
's constructor constexpr. (and possibly do the same forDiagonalMatrix
) - Make the size methods (
mat_cols()
,mat_rows()
) static
Let me know which (or if any) option is preferred so I can prepare a fix.