[C++-sig] Interface slices between python and c++
Neal D. Becker
ndbecker2 at verizon.net
Thu Jul 29 16:48:42 CEST 2004
I now have some experience using boost::python with vector_indexing_suite to
expose std::vector objects to python. Using this, it is easy to expose c++
algorithms written for stl-style iterators.
Consider an algorithm F1:
template<typename it_t>
void F1 (it_t start, it_t end);
We can do:
template<typename cont>
void wrap_f1 (cont c) {
F1 (c.begin(), c.end());
}
and then expose wrap_f1<vector<double> >, for example.
But now, suppose we want to apply algorithm F1 to a *slice* of a vector?
I noticed that in boost.cvs, there is "slice.hpp". AFAICT,
vector_indexing_suite is not using it, though.
OK, so my question is, what is a "good" approach to this? I would add, I
think this must be a very common issue.
More information about the Cplusplus-sig
mailing list