Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2007-01-30 13:54:21


John Maddock wrote:
> In the tutorial it says:
>
> " Even the extractors can accept named parameters. In a bit, we'll see a
> situation where that is useful."
>
> But I can't find any further mention of extractors with named parameters, I
> ask because I believe it may be indeed be useful - for example a student's t
> test could defer requiring the acceptable risk level until the extractor is
> actually called - so the same test could be conducted multiple times with
> different risk levels for example just by calling the extractor multiple
> times.

Whoops. I had intended to document how to use an external accumulator
for the weight statistics, which can then be passed in as a parameter at
extraction time. (Essentially, dependencies within an accumulator set
can be resolved by promising to pass in the required accumulator at
extraction time.) But apparently I never got around to it. I'll fix that.

> One other thing I've missed is the ability to "reset" an accumulator so it
> can be used more than once. Is this possible? Potentially it might save
> quite a bit of construction cost in some cases?

Would you like to be able to reset an accumulator, or the whole set?
Nothing stops you from writing an accumulator with a reset() member
function. You can use accumulator_set::extract() to fetch the
accumulator corresponding to a certain feature and then call reset() on it.

It might be nice to have an accumulator_set::reset() member function
that resets all the accumulators in order. But what should happen to
accumulators that don't define a reset() function? Destroy and
reconstruct them in-place? That could be trouble. Skipping them would be
trouble, too.

-- 
Eric Niebler
Boost Consulting
www.boost-consulting.com

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