[C++-sig] Output iterator parameters

David Abrahams dave at boost-consulting.com
Fri Feb 17 05:20:58 CET 2006


François Duranleau <duranlef at iro.umontreal.ca> writes:

> Hi!
>
> I have a few functions/member functions to export to Python that pose me 
> some problems. They all take at least an output iterator as a parameter, 
> e.g.:
>
> template < typename OutputIterator >
> OutputIterator
> nearest_neighbors( const sample_set& s ,
>                    std::size_t k_nearest ,
>                    OutputIterator out )
> {
>     // ...
>     return out ;
> }
>
> In a previous thread about 'optimizing away calls to the python runtime', 
> I also mentioned a similar problem with functor arguments. In that case we 
> could handle it using boost::function and a function converting (actually, 
> wrapping) Python callable objects to boost::function objects. But we do 
> not have such an abstraction class for iterators, although maybe it could 
> be possible to write one. Bar that, what could I do? Some "solutions" I 
> can see so far are:

See any_iterator in the Adobe open source library.

Aleksey, maybe meta-comm should contribute its versions to the
iterator library.  We keep getting requests for it.  What do you
think?

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com




More information about the Cplusplus-sig mailing list