Using opOpAssign, cannot assign sequence
ag0aep6g
anonymous at example.com
Fri Apr 5 18:02:53 UTC 2019
On 05.04.19 16:00, Alex wrote:
> 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.
`tuple` works for me:
----
import std.typecons: tuple;
class X(T ...)
{
void opOpAssign(string op)(T d) {}
}
void main()
{
auto x = new X!(int, float, string);
int a = 42;
float b = 4.2;
string c = "foo";
x += tuple(a, b, c);
}
----
More information about the Digitalmars-d-learn
mailing list