Boost logo

Boost :

Subject: Re: [boost] a safe integer library
From: David Stone (david_at_[hidden])
Date: 2016-01-14 10:56:55


Hi Brook,

On Tue, Jan 12, 2016 at 9:46 AM, Brook Milligan <brook_at_[hidden]> wrote:

> > On Dec 17, 2015, at 12:16 AM, David Stone <david_at_[hidden] <mailto:
> david_at_[hidden]>> wrote:
> >
> > I have written a similar library (http://doublewise.net/c++/bounded/ <
> http://doublewise.net/c++/bounded/>), and
> > I have a few questions about your implementation.
>
> I am curious whether either of you (Robert and David) have handled the
> need to evaluate the condition “is X (an object of type with some
> _potentially_ wide range) within bounds of Y (an object of type with some
> _potentially_ narrow range)?
>

In my bounded::integer library, I have a few functions in the detail
namespace.

value_fits_in_type<type>(value);
type_overlaps_range<type>(min, max);
type_fits_in_range<type>(min, max);
types_overlap<T1, T2>::value

I plan on rewriting this part of my code at some point to use Boost.Hana
and give it a more consistent interface. As you can see, I think I actually
covered almost every possibility except your use case of type_fits_in_type,
but the definitions are pretty straightforward.

When I rewrite them, I may consider moving them out of the detail namespace.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk