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() 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

One other difference (which I just found the hard way when updating from 
boost-1.39 to boost-1.40):

The cast will stop working if a minor change is made to the function 
signature, while the 'alias' will not break so easily.

_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to