[C++-sig] Automatic conversions for const std::string&

Gabriel Becedillas gabriel.becedillas at corest.com
Thu Dec 21 19:58:10 CET 2006

I have a lot of functions returning "const std::string&". Every time I
wrap one of those I have to do it like this:

class_.def("name", &someclass::bla,

Is there a way to register a return value conversion for "const
std::string&" so I can omit the 
every time I have to wrap this functions ? I wan't those strings to be 
copied to python as new strings (I don't want to hold a pointer to them).

More information about the Cplusplus-sig mailing list