What is the state of opAssign?
BCS
ao at pathlink.com
Fri Oct 19 22:45:27 PDT 2007
Reply to Jarrett,
> "BCS" <BCS at pathlink.com> wrote in message
> news:ffbf1l$cbo$1 at digitalmars.com...
>
>> Is it or will it be possible, in v1.0 or v2.0, to define overloads
>> sutch that this works?
>>
>> class C{}
>>
>> auto c = new C;
>>
>> real r = c;
>>
> It's called opImplicitCast, and yes, it will be in D2.
>
Hmmm. I was hoping for something along the lines of opAssing_r because I'm
hoping to use the original value of the lvalue for something.
would this work
class C
{
static C opImplicitCastFrom(real r){...}
C opAssign(B b){...}
}
class B {}
auto b = new B;
real r = 5;
r = b; //opImplicitCastFrom(r).opAssign(b);
More information about the Digitalmars-d-learn
mailing list