From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-07-16 12:00:22
----- Original Message -----
> Do default function arguments work automatically?
> If I have a function f(int i=1), I have to define it twice in order
> to get the behaviour I want:
> def( ( void (*) () )f, "f")
> def( ( void (*) (int) )f, "f")
Actually, I'm fairly certain that even the above won't work (or if it does,
you're in undefined behavior land). You really need separate overloaded
versions of f.
> Would be really nice if Boost did this automatically, like SWIG ;-)
That's impossible without parsing the C++ code, since the function pointer
carries with it no information about default arguments.
If someone was interested in adding this feature, it would be possible to
provide a different def() function overload which takes as a parameter the
number of default arguments and generates all of the neccessary Python
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk