我只是想知道是否有任何东西(在 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>());
结果当然应该是 {3, 7, 7} 而不是 std::plus 可以是任何 binary_function。
因此,如果有人有想法,请告诉我。