Boost logo

Boost :

From: Robert Kawulak (kawulak_at_[hidden])
Date: 2008-05-21 07:04:28


> From: Neal Becker
> Robert Kawulak wrote:
> > You can write error policy:
> >
> > struct stretchy_policy {
> > template <typename V, typename C>
> > void operator () (const V &, const V & new_val, C & constraint)
> > {
> > if( constraint.is_below(new_val) )
> > constraint.lower_bound() = new_val;
> > else
> > constraint.upper_bound() = new_val;
> > }
> > };
[snip]
> It wouldn't be part of the error_policy, since the extrema
> might be within
> bounds and error_handler wouldn't then be invoked.

I'm not sure I get what's your point here. The idea is to make an error policy,
which, when "error" is detected (out-of-bounds value assigned), corrects the
bounds to make the new value fit within them. This way the bounds actually are
the extrema. Of course, if the error handler is not invoked, this means that the
value is between the past extrema and therefore no extremum is updated.

Best regards,
Robert


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