advise about safety of using move in an opAssign with __traits(isRef

aliak something at something.com
Sat Aug 17 12:12:51 UTC 2019


On Friday, 16 August 2019 at 14:29:26 UTC, Paul Backus wrote:
> On Friday, 16 August 2019 at 08:07:28 UTC, aliak wrote:
>> [...]
>
> Even simpler:
>
> void opAssign(auto ref Optional!T rhs) {
>     import core.lifetime: forward;
>     this._value = forward!rhs;
> }

That doesn't work with private members unfortunately :( - i.e. 
this.value = forward!(rhs._value) - member inaccessible.

Is there a known workaround for that? If not then should I just 
copy the implementation in place to be correct?


More information about the Digitalmars-d-learn mailing list