Sequence separation

Lodovico Giaretta via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Aug 17 01:37:32 PDT 2016


On Tuesday, 16 August 2016 at 23:18:28 UTC, Adam D. Ruppe wrote:
> On Tuesday, 16 August 2016 at 19:17:27 UTC, Engine Machine 
> wrote:
>> alias x = AliasSeq!(a, b, AliasSeq!(c, d));
>>
>> results in a flat sequence. I would like to be able to keep 
>> them separate so I can have sub sequences.
>
> wrap them in a struct.

You mean something like:

struct MySequence(Args...)
{
     enum length = Args.length;
     alias args = Args;
}

alias x = MySequence!(a, b, MySequence!(c, d));

static assert(x.length == 3)
static assert(x.args[2].length == 2);


More information about the Digitalmars-d-learn mailing list