1

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.

DropDropped
  • 1,253
  • 1
  • 22
  • 50
  • I don't think this answers your question but the correct method for setting `wxTextCtrl` contents is `SetValue()`, not `SetLabel()`. – VZ. Dec 04 '12 at 18:27

1 Answers1

2

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*.

VZ.
  • 21,740
  • 3
  • 39
  • 42
  • Thanks, it worked with bind2nd. I also changed the argument "" - I made a const wxString str = "" which I put there. – DropDropped Dec 05 '12 at 15:37