Boost logo

Boost :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2001-07-03 11:35:27

On Tue, 3 Jul 2001, Douglas Gregor wrote:

> On Tuesday 03 July 2001 09:43, you wrote:
> > On Mon, 2 Jul 2001, Douglas Gregor wrote:
> > > Combiner function objects have a simple syntax: they take two input
> > > iterators [first, last) and choose their value from the values returned
> > > by the iterators. The value the combiner returns is the value returned by
> > > the slot, i.e.,
> >
> > Quick question: why did you choose to have the user write the loop instead
> > of calling std::inner_product with user-defined compare and combine
> > function objects?
> I'm not quite sure how std::inner_product would work - where is the second
> iterator range? Combiners take only one input iterator range [first, last)...

What was I thinking.. I meant std::accumulate :)

> A possibility for taking the loop out of the user's hands would be to allow
> the user to specify an function object that:
> - Is invoked for each value returned by a slot.
> - Returns a boolean that says whether to stop or not
> - Has a "value" function that returns the final value
> However, I think this approach is less familiar to users (there really isn't
> precedent for it in the standard library, AFAICT) than the iterator approach.
> Also, I think just supplying a combiner that takes an iterator range is more
> flexible. One could use a signal or a boost::function object to combine the
> results of a signal call, which would be tough behavior to duplicate by just
> supplying a function object that gets invoked at each value.

Tis true.


 Jeremy Siek www:
 Ph.D. Candidate, IU B'ton email: jsiek_at_[hidden]
 Summer Manager, AT&T Research phone: (973) 360-8185

Boost list run by bdawes at, gregod at, cpdaniel at, john at