C++ bounded::integer library

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


On Monday, 19 May 2014 at 19:54:07 UTC, bearophile wrote:
> Nordlöw:
>
>>> 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)
>
> Is this giving a compile-time error?
>
> saturated!byte b = 127;
>
> Bye,
> bearophile

Yes

     saturated!byte bb = 127;

fails as

     bound.d(425,20): Error: saturated!(byte, true) is used as a 
type

because saturated is an instantiator function. Shouldn't it?


More information about the Digitalmars-d mailing list