The source project of this merge request has been removed.
Make DenseVector assignment operator work
Currently, assigning two DenseVector
s does not work properly. Doing something like
template <class V>
void assign(DenseVector<V>& v, const DenseVector<V>& w)
{
v = w;
}
FieldVector<double, 3> v(0), w(1);
assign(v, w);
will compile and execute fine, but after the assign v
will still be filled with zeros, as the default copy assignment operator of DenseVector
is used (which does not copy anything as DenseVector
does not contain data). This bit me when trying to write code that works for both FieldVector
and DynamicVector
and is hard to detect as there are no errors or warnings. If the DenseVector
should not be assigned, there should at least be an error during compilation (e.g. by deleting the copy assignment operator).
This MR adds a test similar to the code above and fixes the test by adding a working operator=
to DenseVector
.