[C++-sig] range with virtual functions

Roman Yakovenko roman.yakovenko at gmail.com
Wed Mar 28 22:50:44 CEST 2007


On 3/28/07, Piotr Jaroszynski <p.jaroszynski at gmail.com> wrote:
>
> Hello,
>
> I have yet another "problem" :] I want to expose a begin_foo and end_foo
> functions as an iterable object like:
> .add_property("foo", range(&Blah:begin_foo, &Blah::end_foo))
>
> How can I do it when begin_foo and end_foo are virtual functions? I am
> interested in both cases, when they are pure virtual and  virtual with
> default implementation.


I am not sure whether range takes references to [pure]virtual functions,
but you
can use same trick as in your previous question: define 2 static functions,
which take reference to your class instance and return relevant iterator.
Than expose
these functions. This should work.

-- 
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20070328/ed2a2d01/attachment.htm>


More information about the Cplusplus-sig mailing list