Boost logo

Boost :

From: Michael Fawcett (michael.fawcett_at_[hidden])
Date: 2007-10-08 12:14:25


On 10/5/07, François Duranleau <duranlef_at_[hidden]> wrote:
>
> Yes, of course. I was mostly pointing out a difference from what we are
> used to in STL. I see no reason why it should be different, and it would
> actually be trivial to add the accessor.

(There was a typo in my reply to your post, but I think the code was
still understandable)

Sorry, I mistook your original post as wondering "how and why", not
just "why", and given that I didn't know "why", I answered "how".

I agree, it would be nice if it was (almost) idiomatic, and you could
do something like:

averager total = kdtree.within_bounds(bounds,
boost::make_function_output_iterator(averager())).function;
total.avg /= total.num;

within_bounds would have to return the OutputIterator if it was to
remain generic, and at the call site you would need to access it's
function object, just like you suggested.

I guess we'll have to wait for a developer response as to why it was
implemented the way it was...

--Michael Fawcett


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