C++ bounded::integer library

"Nordlöw" via Digitalmars-d digitalmars-d at puremagic.com
Mon May 19 12:40:06 PDT 2014


> Another way to improve it is to add to D something like the 
> "enum preconditions" I've discussed in past. So this bug can be 
> detected at compile-time:
>
> Bound!byte b = 200;

This is already handled

For example

     const b127 = saturated!byte(127);

compiles but

     const b128 = saturated!byte(128);

errors as

bound.d(421,32): Error: saturated (inout(byte) x) is not callable 
using argument types (int)


More information about the Digitalmars-d mailing list