tuple(...).each error; why does foreach work and std.algorithms.each doesn't ?
Adam D. Ruppe
destructionator at gmail.com
Tue Feb 11 18:21:11 UTC 2020
On Tuesday, 11 February 2020 at 18:11:44 UTC, wjoe wrote:
> In my mind, if something works with foreach, it should also
> work with std.algorithm.each.
They are very different, the each thing only works for ranges
whereas foreach works with a variety of things.
> How is 1) different from 2) ?
The ARGS... is a compiler list and can have multiple different
types included. Moreover, it will auto-expand when you use it to
call a function etc.
You can sometimes do [args] - with the [] around it to turn into
an array. Then you can .each it and so on. But they must already
be of compatible types to do that since an array elements must
all be the same thing.
I would suggest just using foreach for this.
More information about the Digitalmars-d-learn
mailing list