Search code examples
c++wxwidgetsdequemem-fun

Set labels of multiple wxTextCtrls to empty values using foreach


I've been trying to set multiple labels of wxTextCtrl to empty values using for_each like this:

std::deque<wxTextCtrl*> dqImg;

for_each (dqImg.begin(),dqImg.end(),bind1st(mem_fun(&wxTextCtrl::SetLabel),""));

the problem is it gives me this error:

Error 1 error C2535: 'void std::binder1st<_Fn2>::operator ()(const wxString &) const' : member function already defined or declared d:\...\visualstudio2012\vc\include\xfunctional  286

Could you please explain me what am I doing wrong? Thanks.


Solution

  • I don't really understand the error message (which version of the compiler do you use?) but you should use bind2nd, not bind1st, because the first parameter of the functor returned by mem_fun() is wxTextCtrl*.