How to have strongly typed numerical values?

Nicholas Londey londey at gmail.com
Tue Sep 4 17:55:45 PDT 2012


Hello.
I am trying to work out if there is existing support for strongly 
typed numerical values for example degrees west and kilograms 
such that they cannot be accidentally mixed in an expression. I 
have vague recollection of seeing a presentation by Walter 
talking about this but I cannot seem to find it. I have looked at 
std.typecons.Typedef and Proxy but neither seem to do what I want 
or at least fail to compile for the expression n =  n + n;. I 
could easily implement my own as I have done in C++ in the past 
but assume there is a standard implementation which I would 
prefer.
Any help or links to examples much appreciated.

Regards,

Nicholas


More information about the Digitalmars-d-learn mailing list