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

Roman Yakovenko roman.yakovenko at gmail.com
Tue Aug 15 12:26:05 CEST 2006

On 8/15/06, cbailly <b.christophe at yahoo.fr> wrote:
> 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)
> {
>      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 ?

This link http://boost.org/libs/python/doc/v2/faq.html#custom_string
will help you to
understand what is going on in this specific case.

Roman Yakovenko
C++ Python language binding

More information about the Cplusplus-sig mailing list