[C++-sig] Automatic argument conversion

Ralf W. Grosse-Kunstleve rwgk at yahoo.com
Mon Jul 25 15:04:14 CEST 2005


Hi Eric,

--- Eric Jardim <ericjardim at gmail.com> wrote:

> it will work correctly, because Boost.Python know how (somehow) to convert 
> "std::string"s to Python "str" strings and vice-versa.

Boost.Python comes with built-in converters for the C++ built-in types and a
few other types like std::string and std::complex<> with a Python counterpart.

> But if I have a function, like that one, but instead of a known type I have 
> another string type:
> 
> void
> SomeClass::my_print(const QString& s)
> {
> ...
> }
> 
> How do I say to Boost.Python that everytime it sees a "QString" argument, 
> and it have a Python "str", I can apply a simple converter, just like 
> "std::string"?

I think this will answer your question:

http://mail.python.org/pipermail/c++-sig/2003-May/004133.html

Cheers,
        Ralf



		
__________________________________ 
Yahoo! Mail for Mobile 
Take Yahoo! Mail with you! Check email on your mobile phone. 
http://mobile.yahoo.com/learn/mail 



More information about the Cplusplus-sig mailing list