Re: Template constructor in a non-template struct.

2015-02-14 Thread ChrisG via Digitalmars-d-learn
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

Template constructor in a non-template struct.

2015-02-08 Thread ChrisG via Digitalmars-d-learn
Hi, I couldn't find information about problem I'm having. This builds: enum { Option1, Option2 } struct boring { this(int Opt = Option1)(int arg1, int arg2) { ... } } However, I can't figure out how to instantiate that constructor. When I call it like this: auto a = boring(1, 2); The

Re: Template constructor in a non-template struct.

2015-02-08 Thread ChrisG via Digitalmars-d-learn
to my question. If my struct is used by anyone else though, I'm not sure it would be OK to assume they would even be aware of that syntax. hmmm... Thinking I'll just make it a runtime parameter for now. Thank you. -Chris On Sunday, 8 February 2015 at 21:58:40 UTC, bearophile wrote: ChrisG

Re: PostgreSQL driver

2015-01-25 Thread ChrisG via Digitalmars-d-learn
So, it's been about a year since you asked this. Did you ever determine which PostgreSQL library to use? Is there one that makes any more sense than the others?

Re: struct Unique(T)

2013-11-07 Thread ChrisG
On Thursday, 7 November 2013 at 01:09:45 UTC, Chris Cain wrote: On Thursday, 7 November 2013 at 00:07:25 UTC, ChrisG wrote: My question is: what's the status of D's struct Unique? It looks like struct RefCounted is current, but I can't tell with Unique. There's several comments in the source

struct Unique(T)

2013-11-06 Thread ChrisG
Hi, I've been following the D language off and on for several years, have read Andrei's D book, but haven't ever posted here before. Mostly, I come from a C++ and C# background. Recently, I was playing with D using the derelict bindings for the SDL library. The SDL library uses handles in