Im using Ubuntu 19.01 with g++9.1 to test the parallel new algorithms from the c++17.
I've already tested sucessfully with the algorithms std::sort and the std::reduce.
To compile i use:
g++-9.1 -std=c++17 -Wall -Wextra -pedantic t0.cpp -o t0 -ltbb
When i try to complipe the code it always appears this error:
erro: no matching function for call to ‘exclusive_scan(std::vector<int, std::allocator<int> >::iterator, std::vector<int, std::allocator<int> >::iterator, std::ostream_iterator<int>, int)’
What could be?
#include <functional>
#include <iostream>
#include <iterator>
#include <numeric>
#include <vector>
#include <algorithm>
int main()
{
std::vector data {3, 1, 4, 1, 5, 9, 2, 6};
std::cout << "exclusive sum: ";
std::exclusive_scan(data.begin(), data.end(),
std::ostream_iterator<int>(std::cout, " "),
0);
std::cout << "\ninclusive sum: ";
std::inclusive_scan(data.begin(), data.end(),
std::ostream_iterator<int>(std::cout, " "));
std::cout << "\n\nexclusive product: ";
std::exclusive_scan(data.begin(), data.end(),
std::ostream_iterator<int>(std::cout, " "),
1, std::multiplies<>{});
std::cout << "\ninclusive product: ";
std::inclusive_scan(data.begin(), data.end(),
std::ostream_iterator<int>(std::cout, " "),
std::multiplies<>{});
}