Re: Sequence separation

2016-08-21 Thread Alexandru Ermicioi via Digitalmars-d-learn
On Wednesday, 17 August 2016 at 19:38:22 UTC, Engine Machine wrote: Well, the is does work and that probably is the best solution. I don't mind the extra type at this point. Of course, a library solution for this type of stuff would be nice. I'd rather not have to even use a type but rather

Re: Sequence separation

2016-08-17 Thread ag0aep6g via Digitalmars-d-learn
On 08/17/2016 09:21 PM, Lodovico Giaretta wrote: import std.traits: TemplateOf; static if (__traits(isSame, TemplateOf!(x.args[2]), MySequence)) { ... } std.traits.TemplateOf extracts the symbol representing the uninstantiated template. __traits(isSame, symbol1, symbol2) evaluates at

Re: Sequence separation

2016-08-17 Thread Engine Machine via Digitalmars-d-learn
On Wednesday, 17 August 2016 at 19:15:48 UTC, ag0aep6g wrote: On 08/17/2016 08:38 PM, Engine Machine wrote: [...] [...] [...] With MySequence being a type, you can do this: static if (is(x.args[2] == MySequence!Args, Args ...)) { ... } It works! Nifty that you can do that

Re: Sequence separation

2016-08-17 Thread Engine Machine via Digitalmars-d-learn
On Wednesday, 17 August 2016 at 19:21:57 UTC, Lodovico Giaretta wrote: On Wednesday, 17 August 2016 at 19:15:48 UTC, ag0aep6g wrote: [...] import std.traits: TemplateOf; static if (__traits(isSame, TemplateOf!(x.args[2]), MySequence)) { ... } std.traits.TemplateOf extracts the symbol

Re: Sequence separation

2016-08-17 Thread Engine Machine via Digitalmars-d-learn
On Wednesday, 17 August 2016 at 18:38:48 UTC, Engine Machine wrote: On Wednesday, 17 August 2016 at 08:37:32 UTC, Lodovico Giaretta wrote: On Tuesday, 16 August 2016 at 23:18:28 UTC, Adam D. Ruppe wrote: [...] You mean something like: struct MySequence(Args...) { enum length =

Re: Sequence separation

2016-08-17 Thread Lodovico Giaretta via Digitalmars-d-learn
On Wednesday, 17 August 2016 at 19:15:48 UTC, ag0aep6g wrote: On 08/17/2016 08:38 PM, Engine Machine wrote: On Wednesday, 17 August 2016 at 08:37:32 UTC, Lodovico Giaretta wrote: [...] You mean something like: struct MySequence(Args...) { enum length = Args.length; alias args = Args;

Re: Sequence separation

2016-08-17 Thread ag0aep6g via Digitalmars-d-learn
On 08/17/2016 08:38 PM, Engine Machine wrote: On Wednesday, 17 August 2016 at 08:37:32 UTC, Lodovico Giaretta wrote: [...] You mean something like: struct MySequence(Args...) { enum length = Args.length; alias args = Args; } alias x = MySequence!(a, b, MySequence!(c, d)); static

Re: Sequence separation

2016-08-17 Thread Engine Machine via Digitalmars-d-learn
On Wednesday, 17 August 2016 at 08:37:32 UTC, Lodovico Giaretta wrote: 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

Re: Sequence separation

2016-08-17 Thread Lodovico Giaretta via Digitalmars-d-learn
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

Re: Sequence separation

2016-08-16 Thread Adam D. Ruppe via Digitalmars-d-learn
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.