I can not compile
template
int parallel_sum(const RAIter beg, const RAIter end) {
const auto len = end-beg;
if(len < 1000) return std::accumulate(beg, end, 0);
const RAIter mid = beg + len/2;
auto handle = std::async(std::launch::async, parallel_sum, mid, end);
const int sum = parallel_sum(beg, mid);
return sum + handle.get();
}
int main() {
std::vector v(10000, 1);
std::cout
using "g++ -Wall -std=c++11", but running it I get terminate called after throwing an instance of 'std::system_error' what(): Unknown error -1
Aborted (core dumped)