www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - alias sequences of sequences

reply Alex <AJ gmail.com> writes:
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.
Apr 06 2019
next sibling parent ag0aep6g <anonymous example.com> writes:
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.
Apr 07 2019
prev sibling parent aliak <something something.com> writes:
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
Apr 07 2019