xxxxxxxxxx
struct tie
{
static alias opIndexAssign = opIndexOpAssgin!"";
static template opIndexOpAssgin(string op)
{
void opIndexOpAssgin(T, Ts...)(T rhs, ref Ts args)
{
static foreach (i; 0 .. Ts.length)
{
args[i] = rhs[i];
}
}
}
}
void main()
{
import std.typecons : tuple;
int x;
double y;
tie[x, y] = tuple(1, 3.14);
assert(x == 1 && y == 3.14);
}