c++ - std::bind to std::function? -


i compile error using this:

std::vector<std::function<int(int)>> functions; std::function<int(int, int)> foo = [](int a, int b){ return + b; }; std::function<int(int)> bar = std::bind(foo, 2); functions.push_back(bar); 

the error is:

/usr/include/c++/4.6/functional:1764:40: error: no match call '(std::_bind<std::function<int(int, int)>(int)>) (int)' 

can tell me how convert std::bind std::function?

std::function<int(int)> bar = std::bind(foo, 2, std::placeholders::_1); 

Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -