0

I have a class which works with files, the constructor is receiving a std::function for sending the status of the work to a GUI Library if used.

Declaration:

DASM(std::string filename, std::function<void(unsigned int, unsigned int)> f = nullptr);

in the definition I have wrote:

if(f!=nullptr)
  f(i,decodedInstructionsCount);

my LoadWindow has following function:

std::function<void(unsigned int,unsigned int)> get_f()
    {
        std::function<void(unsigned int,unsigned int)> ret = std::bind(&LoadWindow::pb_next,_2,_1);
        return ret;
    }

and the void LoadWindow::pb_next looks like this:

void LoadWindow::pb_next(unsigned int now, unsigned int max)
{
    this->m_progressbar.set_fraction(((double)now/(double)max));
}

VC++ says:

error C2064: Expression does not resolve in a function which accepts 2 arguements.

I have a German VS so I translated the error.

Thank you for Help

SepGuest
  • 127
  • 1
  • 11
  • How `LoadWindow::pb_next` is declared? If it's a member function, what about binding the `this` argument? – oakad Apr 09 '14 at 06:58
  • You mean std::bind(&LoadWindow, this, _2, _1) ? – SepGuest Apr 09 '14 at 07:01
  • possible duplicate of [Using generic std::function objects with member functions in one class](http://stackoverflow.com/questions/7582546/using-generic-stdfunction-objects-with-member-functions-in-one-class) – juanchopanza Apr 09 '14 at 07:02
  • You missing code. Also why not indicate which line this is erroring on? – Dan Apr 09 '14 at 07:13
  • VC++ is saying that the error is in the header . But the problem is solved. The Keyword this was missing – SepGuest Apr 09 '14 at 07:25

0 Answers0