[C++-sig] C++ clas with (*args, **kwargs) constructor
Jim Bosch
talljimbo at gmail.com
Thu Jun 21 23:57:23 CEST 2012
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
More information about the Cplusplus-sig
mailing list