What is the state of opAssign?

Nathan Reed nathaniel.reed at gmail.com
Sat Oct 20 00:45:28 PDT 2007


BCS wrote:
> 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);
> 
> 

I'd be very suspicious of using the return value of a function as an lvalue!

What is the value in 'r' after this code has executed??

Thanks,
Nathan Reed


More information about the Digitalmars-d-learn mailing list