[C++-sig] How argument passing works with boost python ?

cbailly b.christophe at yahoo.fr
Tue Aug 15 11:26:35 CEST 2006


Hi,

    I have read tutorials/FAQS about boost python but still, I do not  
understand how arguments are passed and converted (automatically ?) to the  
C++ types... since the profile of the methods are not declared.

For instance, in the Hello world example (from the tutorial)

BOOST_PYTHON_MODULE(hello)
{
     class_<World>("World")
         .def("greet", &World::greet)
         .def("set", &World::set)
     ;
}

"set" method takes a std::string argument (not declared). This is really a  
mystery...  Is the std::string type compatible with the str type ? Where  
is the conversion made ?. What if the method set takes std::string &  
parameter instead ?

Can somebody help me understand the mechanism for argument passing ?  
Thanks a lot,

Chris


-- 
Utilisant le client e-mail révolutionnaire d'Opera :  
http://www.opera.com/mail/




More information about the Cplusplus-sig mailing list