I want to have a struct template auto instantiate when the template parameters are defaulted or missing. Example:

struct Resource(T=int) {
    static auto create() {return Resource(null);}
    this(string s) {}
}

auto resource = Resource.create;

As a plain struct it works, but not as a template:

struct Resource {   // works
struct Resource() {  // fails
struct Resource(T=int) {  // fails

At the call site, this works, but I'm hoping for a few less symbols:

auto resource = Resource!().create;

Any ideas?

Reply via email to