我只是想知道是否有任何东西(在c ++ 11或boost中)可以帮助我做这样的事情:
std::vector<int> v1 = {1, 2, 3};
std::vector<int> v2 = {2, 5, 4};
std::list<int> res;
algorithm(v1.begin(), v1.end(), v2.begin(), v2.end(), back_inserter(res), std::plus<int>());
Run Code Online (Sandbox Code Playgroud)
结果当然应该是{3,7,7},而不是std :: plus可以是任何binary_function.
所以,如果有人有想法,请告诉我.