[C++-sig] Re: Re: custom iterator object

Mike Rovner mike at bindkey.com
Mon Nov 11 23:46:37 CET 2002


That's fine, thanks.
Can you point some usage of iterators_wrappers::wrap(). I couldn't find any.
:(

"Ralf W. Grosse-Kunstleve" <rwgk at yahoo.com> wrote in message
news:20021107211257.69768.qmail at web20201.mail.yahoo.com...
> --- Mike Rovner <mike at bindkey.com> wrote:
> > I have problems with return value. In __iter__ I have to return self,
but
> > there is no Python self yet in wrapping class.
> > So probably I have to duplicate part of the BPL iterator guts, but I got
> > lost :(
>
> You could try this:
>
>   inline
>   boost::python::object
>   pass_through(boost::python::object const& o) { return o; }
>
>       class_<w_t>(python_name)
>         .def("next", next)
>         .def("__iter__", pass_through)
>       ;
>
> Full source:
>
>
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/cctbx/scitbx/include/scitbx/b
oost_python/iterator_wrappers.h
>
> Ralf
>
>
> __________________________________________________
> Do you Yahoo!?
> U2 on LAUNCH - Exclusive greatest hits videos
> http://launch.yahoo.com/u2








More information about the Cplusplus-sig mailing list