Re: boost.python iterators
Dirk Steenpass <[email protected]>
| Newsgroups | gmane.comp.lib.boost.langbinding,gmane.comp.python.c++ |
|---|---|
| Message-ID | <[email protected]> |
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
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf