Sequence separation

Engine Machine via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Aug 17 12:34:48 PDT 2016


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 representing the 
> uninstantiated template.
>
> __traits(isSame, symbol1, symbol2) evaluates at compile time to 
> true if and only if the two symbols represent the same thing 
> (be it a type, an uninstantiated template, an instantiated one 
> or whatever else).

Thanks!

To note, it error's if there is no match ;/


More information about the Digitalmars-d-learn mailing list