On 06/21/2012 05:31 PM, Trigve Siver wrote:


Hi,
I'm trying to find some solution to my problem but without succes. I need to be 
able to export C++ class constructor that takes arbitraty arguments (as in 
python __init__(self, *args, **kwargs). Is it possible to have this kind of 
constructor? I've tried something like this:


I believe this is not possible in Boost.Python. The closest approximations I know of are:

- Use a static method or free function instead of a constructor for this mode of construction in Python. You can wrap a non-constructor with *args, **kwds using boost::python::raw_function.

- Inherit from the wrapped class at the Python layer; the derived class could then have a constructor with *args, **kwds.



Jim
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to