On 5/5/16 6:50 PM, Erik Smith wrote:
Alias works at the cost of adding a 2nd type name:
alias Res = Resource!();
auto res = Res.create
The other problem is that the alias definition by itself instantiates,
which I can't afford.
I have createResource() now, it just doesn't fit well with the rest of
the calling styles.
There is also this approach, which might be slightly more idiomatic
struct Resource(T) {}
struct Policy {}
auto create(alias T)() {
T!Policy r;
return r;
}
auto r = create!Resource;
I believe factory external IFTI functions are quite idiomatic. They are
all over phobos.
-Steve