Issue 1974 - What's your opinion?

John Colvin john.loughran.colvin at gmail.com
Sat Oct 26 17:13:08 UTC 2019


On Saturday, 26 October 2019 at 14:41:38 UTC, John Colvin wrote:
>
> If you want to stick with thinking/implementing by lowering, 
> you could do something like this (for structs at least):
>
> auto ref __opOpAssignImpl(string op, S, T)(ref S s, auto ref T 
> s)
> {
>     return s.opOpAssign!op(forward!s);
> }
>
> and then a+=b is lowered to a.__opOpAssignImpl(b) and if a is 
> an rvalue you will get your error.

Rather obvious typo correction:

auto ref __opOpAssignImpl(string op, S, T)(ref S s, auto ref T v)
{
     return s.opOpAssign!op(forward!v);
}


More information about the Digitalmars-d mailing list