[C++-sig] Virtual Methods + default arguments

David Abrahams dave at boost-consulting.com
Wed Feb 26 05:47:46 CET 2003


Bruno da Silva de Oliveira <bso at inf.ufsc.br> writes:

> Hi!
>
> Is it possible to indicate default arguments for virtual methods,
> using the BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS macro?
>

<snip>

> I also tried to change the second .def to:
>
>    .def("f", &XWrap::f, f_overloads())
>
> and:
>
>    .def("f", &XWrap::default_f, f_overloads())
>
> But with the same results.

This one is on the right track, but you need a separate version of
f_overloads for the second one.  The 2nd argument to def in this case
just carries type information; it could be a null function pointer
for all Boost.Python cares.  It's the 3rd arg which carries all the
info about what functions to call.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com





More information about the Cplusplus-sig mailing list