
On Fri, 5 Oct 2007, Michael Fawcett wrote: [...]
Shouldn't you be able to accomplish what you want following the example at http://www.boost.org/libs/iterator/doc/function_output_iterator.html ? You would have
struct averager { averager(float3& p, int &t) : m_avg(&p), m_num(&t) {}
void operator()(const float3& rhs) const { *m_avg += rhs; *m_num++; }
float3* m_str; int *m_num; };
float3 avg(0, 0, 0); int total = 0; kdtree.within(bounds, boost::make_function_output_iterator(averager(avg, total))); avg /= total;
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. -- Francois Duranleau