21 May 13:04
Re: constrained_value question
From: Robert Kawulak <kawulak <at> student.agh.edu.pl>
Subject: Re: constrained_value question
Newsgroups: gmane.comp.lib.boost.devel
Date: 2008-05-21 11:04:28 GMT
Subject: Re: constrained_value question
Newsgroups: gmane.comp.lib.boost.devel
Date: 2008-05-21 11:04:28 GMT
> 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
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
RSS Feed