Boost logo

Boost :

From: Douglas Gregor (gregod_at_[hidden])
Date: 2001-07-17 07:27:50


On Monday 16 July 2001 10:54, you wrote:
> --- In boost_at_y..., "David Abrahams" <david.abrahams_at_r...> wrote:
> > Hi Ralf,
> >
> > I'm not sure. I think you'd need some funky metaprogramming.
>
> Actually, on
>
> > second thought, I don't see how to get it to work anymore - the
>
> default
>
> > argument values can only be generated by code which tries to call
>
> the
>
> > function directly AFAICT. I think Ulli and I discussed it long ago;
>
> maybe he
>
> > remembers an approach.
>
> Wouldn't it be possible to use something like the constructor<>
> template to generate signatures? For example:
>
> struct hello {
> //..
> int foo(int i, bool b = false);
> };
>
> py_hello.def(boost::python::signature<int>, &hello::foo, "foo");
> py_hello.def(boost::python::signature<int, bool>, &hello::foo, "foo");
>
> Doesn't this look like something that would be easy to implement?
>
> Ralf

Yes, this would be easy to implement. But I don't believe it would be
possible to just have:

py_hello.def(&hello::foo, "foo");

and automatically get both versions.

        Doug


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk