[Dune] [Dune-Commit] dune-istl r929 - trunk/istl

Markus Blatt Markus.Blatt at ipvs.uni-stuttgart.de
Wed Jul 30 11:57:12 CEST 2008


On Wed, Jul 30, 2008 at 11:23:58AM +0200, Carsten Graeser wrote:
> Indeed the free operator+= works. So += and -= should
> be global operators. But if you want
> 
> ScaledIdMatrix a;
> FieldMatrix b=a;
> FieldMatrix c;
> c=a;
> 
> you need a constructor and an assignmentg operator. But the standard (as gcc-4.2.3) says:
> 
>   An assignment operator shall be implemented by a non-static member function [...]
> 
> So I would prefer to implement += and -= and to leaf the cast for the rest.
> Or did I miss another possiblity ? Again, the cast does increase functionality
> (using a slow approach) but does not slow down anything.
> 

But this cast might have side effects which surprise people and are
really hard to find.

If FieldMatrix and ScaledIDMatrix are so much correlated. Then
ScaledIDMAtrix should be moved to common and assignment and explicit
type conversion constructors should be implemented in FieldMatrix.

Cheers,

Markus




More information about the Dune mailing list