Equivalents to policy classes in D

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Thu Apr 19 19:59:35 PDT 2012


On 20/04/12 04:41, Andrej Mitrovic wrote:
> You're doing the equivalent of:
> auto one = Foo;
> but you need:
> auto one = Foo();

Ah, clear.  I'm an idiot -- I wrote my own constructor requiring a number as input!

That said, I'm surprised that it accepts the () given that the constructor does 
ask for a number.  Even if I put in place an in-contract with assert(n > 0), it 
doesn't throw an exception ...


More information about the Digitalmars-d-learn mailing list