Project

General

Profile

Help.error: call of overloaded 'connect(DirChooseDialog* const, <unresolved overloaded function type>)' is ambiguous

Added by 太极美术工程狮 狮长 over 13 years ago

I have two overloaded DirChooseDialog::PopNode. One is void DirChooseDialog::PopNode(),the other is void DirChooseDialog::PopNode(bool).

And I want to connect a WTreeNode's selected signal(it has an argument , which is of type bool) to void DirChooseDialog::PopNode(bool). So I write this code:

WTreeNode * CrtTrNd=new WTreeNode(toWString(CrtFl)); //创建节点。

CrtTrNd->selected().connect(this,&DirChooseDialog::PopNode); //被选中,则填充。How to tell g that I want to connect to the method "PopNode" which has one argument but not to connect to the method "PopNode" without any argument ?

While compiling the code , g says this:

error: call of overloaded 'connect(DirChooseDialog* const, )' is ambiguous

/usr/include/Wt/WSignal:915: note: candidates are: boost::signals::connection Wt::Signal<A1, A2, A3, A4, A5, A6>::connect(T*, void (V::)()) [with T = DirChooseDialog, V = DirChooseDialog, A1 = bool, A2 = Wt::NoClass, A3 = Wt::NoClass, A4 = Wt::NoClass, A5 = Wt::NoClass, A6 = Wt::NoClass]

/usr/include/Wt/WSignal:905: note: boost::signals::connection Wt::Signal<A1, A2, A3, A4, A5, A6>::connect(T
, void (V::*)(A1)) [with T = DirChooseDialog, V = DirChooseDialog, A1 = bool, A2 = Wt::NoClass, A3 = Wt::NoClass, A4 = Wt::NoClass, A5 = Wt::NoClass, A6 = Wt::NoClass]

make: * [DirChooseDialog.o] Error 1

I don't understand template very well , so I need some guy to tell me , how to write the code ?

Or should I remove the "PopNode" which has not any argument and left the one which has one argument?

Please tell me if you need more details.


Replies (2)

RE: Help.error: call of overloaded 'connect(DirChooseDialog* const, <unresolved overloaded function type>)' is ambiguous - Added by Wim Dumon over 13 years ago

I believe you have to cast DirChooseDialog::PopNode to tell the compiler which one you need. I suggest googling for 'c pointer to overloaded member function'.

Regards,

Wim.

RE: Help.error: call of overloaded 'connect(DirChooseDialog* const, <unresolved overloaded function type>)' is ambiguous - Added by 太极美术工程狮 狮长 over 13 years ago

Thank you Wim . I did as what you said and solved the problem.

Wim Dumon wrote:

I believe you have to cast DirChooseDialog::PopNode to tell the compiler which one you need. I suggest googling for 'c pointer to overloaded member function'.

Regards,

Wim.

    (1-2/2)