On Monday, 9 February 2015 at 09:52:13 UTC, Marc Schütz wrote:
You could also hide the ugly __ctor() call behind a nicely
named factory method.
Yes, that's pretty much what I ended up doing. Added a couple
static member functions like:
static Boring CreateWithOption1(args);
static Boring C
On Sunday, 8 February 2015 at 22:19:35 UTC, ChrisG wrote:
Thanks bearophile. Your first suggestion about making the
struct a template is something I considered. However, because
of all the code I've already written that approach would force
me to use inheritance or convert a ton of functions to
Thanks bearophile. Your first suggestion about making the struct
a template is something I considered. However, because of all the
code I've already written that approach would force me to use
inheritance or convert a ton of functions to templates. Ick.
The __ctor syntax looks like the answer
ChrisG:
I don't really understand how I'd differentiate a constructor
template from a class/struct template.
One solution is to use a template struct (struct/class names
start with an upper case in D, while typed enum members usually
start with a lower case):
enum E { option1, option2 }