Anybody have any idea on how to do shared operator overloads?

Ali Çehreli acehreli at yahoo.com
Thu Jun 2 01:00:57 UTC 2022


On 6/1/22 17:36, Ruby The Roobster wrote:
 > A stripped down version of some code I have:

Not much experience here but I made two changes:

1) Added 'shared':

 >          this(Complex!real num = Complex!real(0,0)) shared
 >          {
 >              this.num = num;
 >          }
 >          this(shared Complex!real num = cast(shared
 > Complex!real)Complex!real(0,0))
 >          {
 >              this.num.re = num.re;
 >              this.im.re = im.re;

2) Fixed apparent typos:

   this.num.im = num.im;

 >          }

I can't guarantee that correct functions are called. It just compiles 
with 2.100.0. :)

Ali



More information about the Digitalmars-d-learn mailing list