From: Bo P. <be...@gm...> - 2008-06-15 00:59:25
|
Dear swig users, I need to pass a simple object class A { public: A(int a, int b=0) : a_(a), b_(b) { } int a_; int b_; }; to a bunch of functions such as void func(A a); I use Python to wrap these classes and functions and I can call func(A(1)), func(A(1, 2)) without problem. Because parameter b is not used most of the time, I would like to be able to write func(A(1)) as func(1). This is allowed in C/C++ but Python/Swig gives me a TypeError. Is there a way to let swig call A(1) and pass it to C++ automatically? I understand that I define "void func(int a) { func(A(a)); }" but I really do not want to do this to all such functions. Many thanks in advance. Bo |