operator*= in DenseMatrix, can be completely removed, but in that case returned value will be a DenseVector& and manual downcasting to DenseMatrix& is needed.
Is there a more clear approach from mine?
1 2 3 4 5 6 7 8 9
struct DenseVector
{
DenseVector &operator*=(double s) { /* do things */ return *this; }
};
struct DenseMatrix : public DenseVector
{
DenseMatrix &operator*=(double s) { returnstatic_cast<DenseMatrix&>(static_cast<DenseVector&>(*this) *= s); }
};