On Tuesday, 12 June 2018 at 11:04:40 UTC, bauss wrote:
[snip]
void test(T)()
{
pragma(msg, (getBar!T).baz());
pragma(msg, (getBar!T).helloworld());
import std.stdio;
mixin((getBar!T).baz());
mixin((getBar!T).helloworld());
}
[snip]
Is there a way to avoid having to write "getBar!T" every time
since we cannot store a class into a compile-time variable, how
would one avoid such thing?
static const instance = new Bar!T;
enum text1 = b.baz();
enum text2 = b.helloworld();
However, since it's a const instance, you'll only be able to call
const methods on it, and you'll need to mark baz and helloworld
as const.
--
Simen