[C++-sig] Re: iterator interface question
David Abrahams
dave at boost-consulting.com
Fri Jan 30 18:28:13 CET 2004
"Neal D. Becker" <nbecker at hns.com> writes:
> My question is really generic. I have lots of C++ algorithms written in STL
> style. They pass containers as pairs of iterators.
>
> Consider the generic algorithm X:
>
> template<typename in_t, typename out_t>
> void X (in_t in, in_t inend, out_t out);
>
> Now I have exposed std::vector<double> (for example) to python, so python
> can create a std::vector<double> like:
>
> x = DVec (10)
>
> But what I want to know, how can python call algorithm X, which expects a
> pair of iterators?
>
> Since STL became widely used, it is increasingly common to write algorithms
> in this style, so I hope there is a way to do this.
Again, what do you want to be able to pass to the algorithm?
e.g., any Python sequence, just a vector<double>, a Python iterator,
etc.
There's no one accepted idiom for this across the Python/C++ boundary.
--
Dave Abrahams
Boost Consulting
www.boost-consulting.com
More information about the Cplusplus-sig
mailing list