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
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:
//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