[C++-sig] Methods returning *this

Roman Yakovenko roman.yakovenko at gmail.com
Sun Apr 15 05:56:38 CEST 2007


On 4/15/07, Piotr Jaroszynski <p.jaroszynski at gmail.com> wrote:
> Hello,
>
> I have a problem with wrapping such methods:
> struct Foo {
>         Foo & blah(....) {
>                 (....)
>                 return *this;
>         }
> };
>
> What call policy should I use? I have really (blindly) tried quite a few of
> them and I can't get rid of the segfault when trying to access the object
> after calling its blah method.

return_self: http://boost.org/libs/python/doc/v2/return_arg.html#return_self-spec

by the way segfault could be caused by the function too and may be has
nothing to do with boost.python

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



More information about the Cplusplus-sig mailing list