Re: TemplateOf behavior

2018-01-06 Thread Alex via Digitalmars-d-learn
On Saturday, 6 January 2018 at 22:25:48 UTC, ag0aep6g wrote: On Saturday, 6 January 2018 at 19:58:10 UTC, Alex wrote: template T(alias S) { struct T { this(int dummy) { static assert(__traits(isSame, TemplateOf!(T!arr), T)); } } } Now

Re: TemplateOf behavior

2018-01-06 Thread ag0aep6g via Digitalmars-d-learn
On Saturday, 6 January 2018 at 19:58:10 UTC, Alex wrote: Given the code above, why the static assert inside the mixing template constructor yields false, while the others yield true? Let's resolve the mixin and write out the `T` template in the verbose form. It looks like this then:

TemplateOf behavior

2018-01-06 Thread Alex via Digitalmars-d-learn
//code starts import std.traits; void main() { static assert(__traits(isSame, TemplateOf!(T!arr), T)); } size_t[] arr; struct T(alias S) { mixin Contents!() contents; this(Args)(ref Args args) { contents.__ctor(42); } } static