[C++-sig] Quick question about wrapping methods that have multiple versions
Jean-Sébastien Guay
jean-sebastien.guay at cm-labs.com
Wed Sep 9 07:00:50 CEST 2009
Hi Stefan,
> This is not a wrapper function, but an alias. You create a new variable
> 'B_getA1', and make this point to B::getA (the non-const version).
> This works, since by means of the variable type you disambiguate, so
> using that in the call to def() works unambiguously.
Sorry, thanks for correcting my terminology. :-)
> You may disambiguate by using a cast inside .def(), such as
>
> .def("getA", (A*(B::*)())B::getA);
>
> Whether that's actually more readable is arguable, however.
Yeah, that's true, and it will be especially ugly when the method has
arguments (I guess the cast will then have to include all the argument
types too...)
Thanks,
J-S
--
______________________________________________________
Jean-Sebastien Guay jean-sebastien.guay at cm-labs.com
http://www.cm-labs.com/
http://whitestar02.webhop.org/
More information about the Cplusplus-sig
mailing list