[C++-sig] problem exposing iterators

Roman Yakovenko roman.yakovenko at gmail.com
Sun Jun 20 06:20:14 CEST 2010


On Fri, Jun 18, 2010 at 8:54 AM, abhi.sri45
<abhishek.srivastava at nechclst.in> wrote:
>
> Although for this case I can think of a workable solution, to create some
> kind of wrapper functions(only in bindings) which return *iterator by
> adding:
>
> classB = mb.class_( 'B' )
> classB.add_declaration_code("A getA( B& b ){ vector< A >::iterator iter =
> b.begin(); return *iter ;}")
> classB.add_registration_code( 'def( "begin", &::getA )' , works_on_instance
> = True)
>
> in codeGenerator scripts.
> But can I get some kind of solution where I can expose iterators(some kind
> of support available for iterators).

No need to reinvent the wheel:
* http://www.boost.org/doc/libs/1_43_0/libs/python/doc/v2/iterator.html
- this functionality is not supported by py++
* http://language-binding.net/pyplusplus/documentation/indexing_suite_v2.html.html

HTH
-- 
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/


More information about the Cplusplus-sig mailing list