AliasSeq different from just using the symbol name(s)?
z
z at z.com
Sat Apr 17 18:39:56 UTC 2021
On Thursday, 15 April 2021 at 19:53:57 UTC, Paul Backus wrote:
> They're not *exactly* the same. When you write
>
> auto seq = AliasSeq!(a, b, c);
>
> ...you are declaring a sequence of three *new* array variables
> [1] and initializing them with copies of the original arrays.
> It's as though you'd written:
>
> auto seq_a = a;
> auto seq_b = b;
> auto seq_c = c;
> alias seq = AliasSeq!(a, b, c);
>
> If you want to refer directly to the original variables, you
> need to create your sequence with `alias` instead of `auto`:
>
> alias seq = AliasSeq!(a, b, c);
>
> [1]
> https://dlang.org/articles/ctarguments.html#type-seq-instantiation
Ah thank you so much! i changed `auto` to `alias` and it worked
perfectly.
More information about the Digitalmars-d-learn
mailing list