www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Operator Overloading : opOpAssign

reply "Eyyub" <eyyub.pangearaion gmail.com> writes:
Hai,

I would to know how to overload this operator and why I have this 
error at compile-time : 
http://paste.pocoo.org/show/vlfSSekGLCAriCJpiZvp/

Thanks a lot.
Apr 08 2012
next sibling parent reply Timon Gehr <timon.gehr gmx.ch> writes:
On 04/08/2012 07:56 PM, Eyyub wrote:
 Hai,

 I would to know how to overload this operator and why I have this error
 at compile-time : http://paste.pocoo.org/show/vlfSSekGLCAriCJpiZvp/

 Thanks a lot.

Try void opOpAssign(string op)(const Matrix other) if(op == "+") I think the fact that Matrix!(T,N,M) does not work is a bug. It works if explicitly instantiated.
Apr 08 2012
parent reply Artur Skawina <art.08.09 gmail.com> writes:
On 04/08/12 20:50, Eyyub wrote:
 On Sunday, 8 April 2012 at 18:05:58 UTC, Timon Gehr wrote:
 On 04/08/2012 07:56 PM, Eyyub wrote:
 Hai,

 I would to know how to overload this operator and why I have this error
 at compile-time : http://paste.pocoo.org/show/vlfSSekGLCAriCJpiZvp/

 Thanks a lot.

Try void opOpAssign(string op)(const Matrix other) if(op == "+") I think the fact that Matrix!(T,N,M) does not work is a bug. It works if explicitly instantiated.

Mmh, thanks for your answer but it still does not work... :/.

Try w/ matrices of the same size. artur
Apr 08 2012
parent Timon Gehr <timon.gehr gmx.ch> writes:
On 04/08/2012 10:06 PM, Eyyub wrote:
 It works with : http://paste.pocoo.org/show/4oIhMg5eBdUoirhk5iYS/

 Thanks for all, kiss !

You don't need/want the 'ref's there.
Apr 08 2012
prev sibling next sibling parent "Eyyub" <eyyub.pangearaion gmail.com> writes:
On Sunday, 8 April 2012 at 18:05:58 UTC, Timon Gehr wrote:
 On 04/08/2012 07:56 PM, Eyyub wrote:
 Hai,

 I would to know how to overload this operator and why I have 
 this error
 at compile-time : 
 http://paste.pocoo.org/show/vlfSSekGLCAriCJpiZvp/

 Thanks a lot.

Try void opOpAssign(string op)(const Matrix other) if(op == "+") I think the fact that Matrix!(T,N,M) does not work is a bug. It works if explicitly instantiated.

Mmh, thanks for your answer but it still does not work... :/. So, you think that is a bug ? Thanks
Apr 08 2012
prev sibling next sibling parent "Eyyub" <eyyub.pangearaion gmail.com> writes:
Ho, if I replace "a+=b;" by "a.opOpAssign!"+"(b);" it works...why 
?
Apr 08 2012
prev sibling next sibling parent "Eyyub" <eyyub.pangearaion gmail.com> writes:
arthur: It still does not work to, I think that is a bug.
Apr 08 2012
prev sibling parent "Eyyub" <eyyub.pangearaion gmail.com> writes:
It works with : http://paste.pocoo.org/show/4oIhMg5eBdUoirhk5iYS/

Thanks for all, kiss !
Apr 08 2012