www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - operator +=

reply "Minas Mina" <minas_mina1990 hotmail.co.uk> writes:
How can I define operator += for a struct?
Apr 08 2013
parent reply "Simen Kjaeraas" <simen.kjaras gmail.com> writes:
On 2013-04-08, 14:23, Minas Mina wrote:

 How can I define operator += for a struct?
http://dlang.org/operatoroverloading.html In short: struct S { auto opOpAssign( string op : "+" )( S other ) { // Do stuff here. } } -- Simen
Apr 08 2013
parent "Minas Mina" <minas_mina1990 hotmail.co.uk> writes:
On Monday, 8 April 2013 at 12:37:34 UTC, Simen Kjaeraas wrote:
 On 2013-04-08, 14:23, Minas Mina wrote:

 How can I define operator += for a struct?
http://dlang.org/operatoroverloading.html In short: struct S { auto opOpAssign( string op : "+" )( S other ) { // Do stuff here. } }
Thanks a lot.
Apr 08 2013