Re: unresolved overloaded function signal



Paulo Flabiano Smorigo schrieb:
> Hi everybody.
> 
> Now if one of the functions don't have atributes, like:
> 
> void Red::test(int value);
> void Red::test(char* value);
> void Red::test(); <---
> 
> How would be the signal line?

button.signal_clicked().connect(sigc::mem_fun0(*this, &Red::test));

Note the '0' in sigc::mem_fun0.
The problem is that the compiler finds multiple Red::test() methods and
because sigc::mem_fun<>() is a generic function template the compiler
can't deduce which member function to take, so you have to help it a little:
- by specifying one or multiple template arguments - in your case the
first argument type -> sigc::mem_fun<int>()
- or by picking a function template for a specific number of arguments -
in your case 0 arguments -> sigc::mem_fun0() [or also sigc::mem_fun0<>()]
- or even both -> sigc::mem_fun1<int>()


Klaus


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]