usage of ref foreach with variadic functions fails with "cannot be ref"
error via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Feb 11 07:02:11 PST 2017
On Saturday, 11 February 2017 at 14:43:18 UTC, rikki cattermole
wrote:
> Try:
>
> foreach(i, v; vars) {
> vars[i] = ...;
> }
Perfect! Thanks so much - I wish that hint was in the
documentation for variadic functions, although I guess it
suggests an inefficiency in the compiler - since there would be
an additional copy of vars[i] created in v.
More information about the Digitalmars-d-learn
mailing list