#include <functional> // multiplies #include <numeric> // accumulate // ... std::vector<int> v {2,3,4}; int result = std::accumulate(v.begin(), v.end(), 1, std::multiplies<int>());