Collections question

Jonathan M Davis via Digitalmars-d digitalmars-d at
Sun Nov 29 12:01:02 PST 2015

On Sunday, 29 November 2015 at 15:06:49 UTC, Andrei Alexandrescu 
> Thanks all. I'll go with the factory function. -- Andrei

As Timon suggested, I'd encourage you to go for a free factory 
function named after the container like RedBlackTree does with 
redBlackTree rather than having a static factory function, since 
it's less verbose and allows for type inference, though there's 
no reason why we couldn't have both:

auto c1 = MyCollection!int.make(1, 2, 3);
auto c2 = myCollection!int(1, 2, 3);
auto c3 = myCollection(1, 2, 3);

Regardless, it's better to avoid static opCall.

- Jonathan M Davis

More information about the Digitalmars-d mailing list