On Wednesday, 28 August 2019 at 10:10:08 UTC, Simen Kjærås wrote:
On Wednesday, 28 August 2019 at 05:17:28 UTC, Jabari Zakiya
wrote:
Inside func2 I create an input value for func1 and then assign
func1's 4 outputs to named variable. That's where the problems
arise. func1 does some math based on the input and generates 4
outputs.
I can't do (a, b, c,d) = func1(i) directly.
What do I do to assign the output of func1 to the individual
variables?
import std.meta : AliasSeq;
import std.typecons : tuple;
auto fun() {
return tuple(1, "test");
}
unittest {
int a;
string b;
AliasSeq!(a, b) = fun;
assert(a == 1);
assert(b == "test");
}
--
Simen
When I do this:
uint a; uint b; uint[] c; uint[] d;
AliasSeq!(a, b, c, d) = genPGparameters(pg);
modpg = a;
res_0 = b;
restwins = c;
resinvrs = d;
the compiler (ldc2 1.17) says:
D Projects ~/D/bin/ldc2 --release -O3 twinprimes_ssoznew1.d
twinprimes_ssoznew1.d(170): Error: cannot implicitly convert
expression c of type uint[] to shared(uint[])
twinprimes_ssoznew1.d(171): Error: cannot implicitly convert
expression d of type uint[] to shared(uint[])
where modpg, res_0; restwins, resinvrs are shared (global)
variables.