[C++-sig] return_arg

David Abrahams dave at boost-consulting.com
Fri Aug 5 17:41:17 CEST 2005

"Ira Holtzer" <sheig222 at gmail.com> writes:

>> You need to specify a return value policy when returning pointers and
>> references from functions, because otherwise Boost.Python doesn't know
>> how/whether to manage the lifetime of the thing referred to.  In this
>> case, reference_existing_object looks like the right policy.  Since
>> GetMyClass has no arguments, return_arg certainly can't be the right
>> choice!
> Can you please point me to where I can find an in-depth discussion of return
> value policies?


> Are the 6 models under boost::python docs' ConverterGenerator all I can
> use/need?

You can write your own as long as it conforms to the requirements for

>> P.S. Next time I suggest you copy/paste your actual code and the actual
>> error message.  It was
>> specify_a_return_value_policy_to_wrap_functions_returning
> Lol, sorry about that. The secret police here at where I work restrict us
> from doing *very dangerous* stuff like downloading MP3's, zip files with
> source code in them, installing winamp... Ohh and also posting to
> newsgroups. I have to use a different 'dirty' workstation to post here so I
> can't simply copy/paste.


You might try the GMane web interface to its newsgroup for this
mailing list next time; you should be able to paste into that.

Dave Abrahams
Boost Consulting

More information about the Cplusplus-sig mailing list