On Saturday, 18 June 2016 at 16:05:53 UTC, Gary Willoughby wrote:
I've tried the following code and I get the error:
you still have to instantiate you `Foo` here:
auto foo = Foo.of!(string);
no, you can't call even static methods of *uninstantiated*
template. uninstantiated template doesn'
I've tried the following code and I get the error:
Error: template Foo(A) does not have property 'of'
struct Foo(A)
{
private int _foo;
@disable this();
public this(int foo)
{
this._foo = foo;
}
public static auto of(B)()
(Guess is didn't get sent, I guess I'm just a big spam bot cause
I keep getting flagged every post)
The following code demonstrates a way to have an easy factory in
D requiring very little work. I imagine it can be improved to
handle the abstract case(basically dependencies/constraints).
Any ide