[C++-sig] copy_const_reference on add_property

Roman Yakovenko roman.yakovenko at gmail.com
Wed Aug 20 20:22:50 CEST 2008


On Wed, Aug 20, 2008 at 9:13 PM, Max Ivanov <ivanov.maxim at gmail.com> wrote:
> Hi all!
> If C++ method returns std::strings I'm forced to add
> "return_value_policy<bp::copy_const_reference>()" as third argument to
> "def". How to make similair  for  add_property?

You should use boost::python::make_function

namespace bp = boost::python;

.add_property(
"name"

                        , bp::make_function(
<ref to function>, <call  policies> ) );

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



More information about the Cplusplus-sig mailing list