14
私はこの使用してコンパイルエラーを取得:私が手にエラーがあるstd :: std :: functionにバインドしますか?
std::vector<std::function<int(int)>> functions;
std::function<int(int, int)> foo = [](int a, int b){ return a + b; };
std::function<int(int)> bar = std::bind(foo, 2);
functions.push_back(bar);
を:
/usr/include/c++/4.6/functional:1764:40: error: no match for call to '(std::_Bind<std::function<int(int, int)>(int)>) (int)'
誰かがどのようにstd::function
にstd::bind
を変換するために教えてもらえますか?
「&foo」ではなく、それ以外は正しい。 – Xeo
また、 'using namespace std :: placeholders'が必要です。 – juanchopanza
@Xeo – inkooboo