[C++-sig] Free function returning reference

Kor de Jong k.dejong at geog.uu.nl
Fri Jul 9 10:42:08 CEST 2004


Kor de Jong wrote:
> BOOST_PYTHON_MODULE(foopy) {
>   class_<Foo>("Foo")
>     ;
>   def("setValue", &setValue);
>   def("value", &value, return_internal_reference<>());
> }

I guess I should use reference_existing_object:

BOOST_PYTHON_MODULE(foopy)
{
   class_<Foo>("Foo")
     ;
   def("setValue", &setValue);
   def("value", &value, return_value_policy<reference_existing_object>());
}

Please tell me if I am wrong (I still get a Segmentation fault which could be 
related to this).

Kor




More information about the Cplusplus-sig mailing list