[C++-sig] A couple of simple BP V2 questions

Scott A. Smith ssmith at magnet.fsu.edu
Wed Nov 13 00:12:34 CET 2002


Hi Dave,


> Oh, well of course you can write:
> 
>     scope().attr("PLANCK") = PLANCK;

Yep, I did a "du-oh" just after sending off my last e-mail. Now I am trying
to figure out how to deal with a class member function that returns 
const std::string&. I assume I need to figure out call policies, but the
tutorial info isn't real clear to me. I just have

const std::string& myclass::myfunction()

The compiler complains when I add this to the class using

.def("myfunction", &myclass::myfunction)

but since the function takes no arguments I cannot figure out how
or if I need to modify it with 
return_internal_reference and with_custodian_and_ward. Or perhaps something
else that sets the call policy....

Scott




More information about the Cplusplus-sig mailing list