Using opOpAssign, cannot assign sequence
Alex
AJ at gmail.com
Fri Apr 5 14:00:51 UTC 2019
On Friday, 5 April 2019 at 13:59:27 UTC, Alex wrote:
> class X(T)
> void opOpAssign(string op)(T d)
>
> If T has more than length of one then
>
> x += ????
>
> We can work around this but it seems to me that we should be
> able to get it to work in some way
>
> x += Alias!(a,b,c)
>
> fails to package it up as do all other things I have tried.
>
> void Add(Ts d) { opOpAssign!("+")(d); }
>
> Then x.Add(a,b,c) works fine.
>
> But of course defeats the entire purpose of opOpAssigns short
> hand notation.
>
>
>
>
>
I was thinking using tuple would work(of course is longer than
Add but would allow for a more general approach, it would require
automatic unpacking though and so doesn't work.
More information about the Digitalmars-d-learn
mailing list