On Mon, 15 Aug 2005 22:35:45 -0400, David Abrahams wrote:
Dirk, you're in the wrong mailing list/newsgroup. Try the Python C++ sig (where followups are directed).
Sorry. [snip]
Probably your simplest solution would be something like:
python::object Elements(A& a, A::SizeType n) { return python::range<python::default_call_policies, A>( boost::bind(&A::begin, _1, n) , boost::bind(&A::end, _1, n) )(boost::ref(a)); }
Then wrap that. We create a new Python function object on the fly each time and invoke it. The bind expressions just bind n into the accessors so that they take only a single argument.
HTH,
Yep, that is neat and works. Though the default_call_policies cannot be used as the wrapped iterator returns by reference. Thx, dirk [snip] -- Dirk Steenpass