On Friday, 27 November 2015 at 20:14:21 UTC, Andrei Alexandrescu wrote:
1. Factory function:

This is my preference for zero arg at least because the opCall thing is commonly misunderstood and confused with C++ default construction and we don't need to encourage that.

    static MyCollection opCall(U...)(auto ref U args);
auto c1 = MyCollection!(int)(1, 2, 3);

That syntax is the same as constructors... if that's what you want it to look like, we ought to actually use a constructor for all but the zero-argument ones which I'd use a static named function for (perhaps .make or perhaps .makeEmpty too)

But the opCall in cases where it conflicts with constructors ought to be discouraged.

Reply via email to