[C++-sig] Boost.Python : Return std::string by ref?

Hans Meine meine at informatik.uni-hamburg.de
Thu May 15 11:56:02 CEST 2008


Am Donnerstag, 15. Mai 2008 10:07:20 schrieb Brian O'Kennedy:
> Notice that GetName() now returns the string by const reference; this is
> done in a lot of our c++ code for efficiency sake. To wrap this using
> Boost.Python I do:
>
> [...]
>       .def( "GetName", &MyOtherClass::GetName,
> return_internal_reference<>() )

I'd try copy_const_reference.

-- 
Ciao, /  /
     /--/
    /  / ANS



More information about the Cplusplus-sig mailing list