Steven Schveighoffer wrote: > What I would suggest is static factory methods. The issue with any kind > of typedef (be it with the soon-to-be-deprecated typedef keyword or with > a proxy struct), is that what does this mean? > > auto obj = new Foo([1, 2, 3], "blah"); > > Is "blah" a filename or a message? > --> Error, Foo (int[], string) does not exist.
> Whereas, if you use factory methods: > > auto obj = Foo.createWithFilename([1,2,3], "blah"); // "blah" is a filename > auto obj = Foo.createWithMessage([1,2,3], "blah"); // "blah" is a message > > The code becomes crystal clear. Reduce verbosity as you see fit ;) > auto obj = new Foo ([1, 2, 3], Filename ("blah")); auto obj = new Foo ([1, 2, 3], Message ("blah")); Jerome -- mailto:jeber...@free.fr http://jeberger.free.fr Jabber: jeber...@jabber.fr
signature.asc
Description: OpenPGP digital signature