
Boost : 
From: Neal Becker (ndbecker2_at_[hidden])
Date: 20080520 13:27:45
I have used constrained_value to prototype a fixedpt class. It seems to be
developing nicely.
One thing might be useful is to have the option to record minimum and
maximum values that are used during a given computation.
Right now, I have:
template<int int_bits, int frac_bits, typename base_type=int, typename
error_policy=cv::throw_exception<>, typename
round_policy=rnd<frac_bits,base_type> >
struct fixed_pt : ...
{
typedef fixed_pt<int_bits,frac_bits,base_type,error_policy,round_policy>
self;
static const int total_bits = int_bits + frac_bits;
static const base_type max = ~(base_type(1) << (total_bits1));
static const base_type min = (base_type(1) << (total_bits1));
typedef typename cv::bounded_int<base_type, min,
max,true,true,error_policy>::type val_t;
...
val_t value;
}
So fixed_pt<> contains a bounded_int member.
I'm wondering how to add a facility to track extremal values. It would seem
to be nice to add it into the 'value' member itself, but I suspect this
concept doesn't really fit with the constrained_value design.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk