[C++-sig] Possible overload<> template for class members

Ralf W. Grosse-Kunstleve rwgk at yahoo.com
Fri Dec 13 07:47:15 CET 2002


--- William Trenker <wtrenker at hotmail.com> wrote:
> 	.def("show", overload<void,void>(), &Window::show)
> 	.def("show", overload<void,const Window*>(), &Window.show)

That looks just like my old "plan A" :-)

>   Is something like this even possible?

David kept claiming the answer is no, because in C++ you cannot take the
"address" of a family over overloaded functions. If Window.show has overloads
the compiler has no way of knowing which one you mean if you just type
&Window.show. You have to have an associated cast, our you have to go through a
thin wrapper. This limitation forced us to come up with "plan B": the
BOOST_PYTHON_FUNCTION_OVERLOADS and BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS
macros.

Ralf


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com




More information about the Cplusplus-sig mailing list