Thread Previous • Date Previous • Date Next • Thread Next |
On 17/06/10 14:23, Florian Rathgeber wrote:
Hi, I was wondering why +=, *=, etc. are overloaded in the Vector class, but not addition of Vectors and multiplication of Vectors by scalars. Hence I tried the following: namespace dolfin { Vector operator*( double a, const Vector& v ) { Vector res( v ); res *= a; return res; } Vector operator*( const Vector& v, double a ) { Vector res( v ); res *= a; return res; } Vector operator+( const Vector& v1, const Vector& v2 ) { Vector res( v1 ); res += v2; return res; } } but realized the construction of the return object is not possible since the copy constructor of Vector is explicit.
I've just pushed a change which removes 'explicit' from all the linear algebra copy constructors.
Garth
Is that a design decision that this is not supposed to be possible? I realize that creating a temporary Vector can be quite expensive. Florian _______________________________________________ Mailing list: https://launchpad.net/~dolfin Post to : dolfin@xxxxxxxxxxxxxxxxxxx Unsubscribe : https://launchpad.net/~dolfin More help : https://help.launchpad.net/ListHelp
Thread Previous • Date Previous • Date Next • Thread Next |