alias sequences of sequences
ag0aep6g
anonymous at example.com
Sun Apr 7 10:03:38 UTC 2019
On 07.04.19 06:58, Alex wrote:
> Is there any way to get sequences of sequences?
>
> Using RT, I have to use strings
>
> [[`string`, `0`], ...]
>
> when it would be much better to use
>
> [[string, 0], ...]
>
> Ideally it wouldn't add so much overhead that it defeats the purpose.
You can make a template that doesn't expand the sequence automatically,
and then make a sequence of those:
----
template Box(stuff ...) { alias contents = stuff; }
import std.meta: AliasSeq;
alias s = AliasSeq!(Box!(string, 0), Box!(int, 42));
----
Instead of `s[0][0]`, you'd have to write `s[0].contents[0]`. Don't know
if that's too much overhead.
More information about the Digitalmars-d-learn
mailing list