Thread overview |
---|
April 07, 2019 alias sequences of sequences | ||||
---|---|---|---|---|
| ||||
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. |
April 07, 2019 Re: alias sequences of sequences | ||||
---|---|---|---|---|
| ||||
Posted in reply to Alex | 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.
|
April 07, 2019 Re: alias sequences of sequences | ||||
---|---|---|---|---|
| ||||
Posted in reply to Alex | On Sunday, 7 April 2019 at 04:58:13 UTC, 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. https://aliak00.github.io/bolts/bolts/meta/AliasPack.html |
Copyright © 1999-2021 by the D Language Foundation