
2015-12-14 17:39 GMT+01:00 Robert Ramey
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.