This code is from the book C++17 Standard Library Quick Reference by Apress:
#include <numeric>
#include <vector>
using namespace std;
int main() {
vector vec {4,2,5,1,3,6};
int sum = reduce( begin(vec), end(vec));
}
When I compile it with g++-9.2 using the option -std=c++17 (or -std=gnu++2a) on Windows 7, I get:
error: no matching function for call to 'reduce(std::vector<int, std::allocator<int> >::iterator, std::vector<int, std::allocator<int> >::iterator)'
What's wrong with this code? Thank you.