On Wednesday 25 August 2010 23:49:27 Yao G. wrote:
> On Thu, 26 Aug 2010 01:46:02 -0500, Jonathan M Davis
>
> wrote:
> > Look at http://www.digitalmars.com/d/2.0/operatoroverloading.html (or
> > even
> > better, TDPL). The correct function would be opOpAssign. I believe that
> > the
> > syntax fo
On Thu, 26 Aug 2010 01:46:02 -0500, Jonathan M Davis
wrote:
Look at http://www.digitalmars.com/d/2.0/operatoroverloading.html (or
even
better, TDPL). The correct function would be opOpAssign. I believe that
the
syntax for += would be
opOpAssign!("+")(args) { }
- Jonathan M Davis
Ha ha
On Wednesday 25 August 2010 22:31:38 Yao G. wrote:
> Sorry, I sent the message prematurely :( Anyway, here's complete:
>
> Is there a way to make compound assignment operators (-=, +=, *= and
> friends) work with D's operator overload regime? I can't ma
Yao G.:
> Is there a way to make this work? Even changing the operator string in
> opBinary to "-" doesn't do nothing. Or those kind of operators can't be
> overloaded?
Try opOpAssign.
Bye,
bearophile
Sorry, I sent the message prematurely :( Anyway, here's complete:
Is there a way to make compound assignment operators (-=, +=, *= and
friends) work with D's operator overload regime? I can't make them work.
struct Foo
{
this( int bar ) {
bar = bar;
}
Foo
Is there a way to make compound assignment operators (-=, +=, *= and
friends) work with D's operator overload regime? I can't make them work.
struct Foo
{
this( int foo )
Foo opBinary(string op)( in typeof(this) rhv )
if( op == "-=" )
{