On Apr 16, 2012 5:29 PM, "Namespace" <rswhite4@googlemail.com> wrote:

> That case I would like to prevent, but at the same time allow
> Ivalues. How does that work in D classes?
> As far as I know this operates with structs, but shouldn't it be
> possible with classes and objects too?

I would recommend a precondition.  It is a language enforced method of restricting what values may be passed into a function.  If the code is compiled for release the checks are not included and do not cost anything.