|
Boost : |
Subject: Re: [boost] safe integer library -- the scope
From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2015-12-14 12:21:57
2015-12-14 17:39 GMT+01:00 Robert Ramey <ramey_at_[hidden]>:
On 12/14/15 5:15 AM, Andrzej Krzemienski wrote:
>
>
> That is,
>
>> what benefit does your safe type offer that it shouldn't just be
>>> supplanted
>>> by the range type?
>>>
>>
> safe<T> can be used as a drop in replacement for T . safe...range cannot.
>
Ok, I see. So, there is something more to it than just the set of values.
safe<T> does not check upon conversion from T.
>
> However, since min() and max() are now constexpr, that all can be
>>> collapsed into a single template with three parameterizing types: the
>>> underlying type, the minimum, and the maximum:
>>>
>>> template
>>> <
>>> class T
>>> , T Min = std::numeric_limits<T>::min()
>>> , T Max = std::numeric_limits<T>::max()
>>>
>>>>
>>>> class safe;
>>>
>>
> That's exactly what safe<T> is.
>
> Current implementation has more of these policies (e.g., for how you want
>> to report overflow).
>>
>
> Is there a question in there somewhere?
Nope: I was just replying to Rob.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk