|
Boost : |
From: David Abrahams (abrahams_at_[hidden])
Date: 2001-03-08 23:44:26
----- Original Message -----
From: <rcspython_at_[hidden]>
> I wrapped a class with some methods of the type...
>
> char * myclass::myfunc(int mynum, const char * mystring = NULL)
>
> Now, the wrapped class method does work.. however, when I was testing
> it under the interactive python session, it complained that function
> requires 3 parameters, and I had only provided 2 as in:
>
> import mywrap
>
> mw = mywrap(1)
> mw.myfunc(1) // it didn't like this...
>
> Shouldn't the NULL default be used by the python call?
>
> It didn't complain when I did
>
> mw.myfunc(1,"") // This worked but defeats the purpose of using
> defaults
There isn't yet any support for using default parameters in Boost.Python
You can emulate it by creating a forwarding function in C++:
char* myclass_myfunc1(myclass& self, int x) { self.myfunc(x); }
and exposing that function as "myfunc" using the overloading feature.
Sorry, it's the best I can do for now!
-Dave
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk