Boost logo

Boost :

From: Neal Becker (ndbecker2_at_[hidden])
Date: 2008-05-21 19:25:47


Robert Kawulak wrote:

>> 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.
>
OK, I see the confusion. My idea was to record extrema _in addition to_
some other error policy. For example, throw if out of bounds, but also
collect extrema data. In this case the error policy would not normally
happen.


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