Re: [C++-sig] Quick question about wrapping methods that have multiple versions

2009-09-09 Thread troy d. straszheim
Nicolas Lelong wrote: 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. IMHO, this is quite dangerous as the explicit cast prevents the compiler to give you a proper error if the signa

Re: [C++-sig] Quick question about wrapping methods that have multiple versions

2009-09-09 Thread Neal Becker
Jean-Sébastien Guay wrote: > 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() wor

Re: [C++-sig] Quick question about wrapping methods that have multiple versions

2009-09-09 Thread Nicolas Lelong
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. IMHO, this is quite dangerous as the explicit cast prevents the compiler to give you a proper error if the signature of B::getA changes

Re: [C++-sig] Quick question about wrapping methods that have multiple versions

2009-09-08 Thread Jean-Sébastien Guay
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 cor

Re: [C++-sig] Quick question about wrapping methods that have multiple versions

2009-09-08 Thread Stefan Seefeld
On 09/08/2009 11:30 PM, Jean-Sébastien Guay wrote: If I just add .def("getA", &B::getA, some_return_policy) to my class_ wrapper, on compile it will complain that it doesn't know which version of B::getA() I want. Up until now the way I wrapped this was to make a trivial wrapper function: A