std::exclusive_scan compile fail
I wanted to compare (and benchmark) exclusive_scan, inclusive_scan and partial_sum. So I decided to try out the default sample on cppreference.com
It refused to compile. Same results with cpp.sh and godbolt.org
Any ideas why? I'm using C++17 flags with the latest compilers.
Code
#include <functional>
#include <iostream>
#include <iterator>
#include <numeric>
#include <vector>
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 << "\npartial sum: ";
std::partial_sum(data.begin(), data.end(),
std::ostream_iterator<int>(std::cout, " "));
}
Error
Fails on all but trunk GCC. See the godbolt link for errors (or the cppreference). Basically, either it fails to find the function, or always want to use the std::execution_policy version.
Posted Sep 30, 2019, 11:50 AM UTC
12
It seems like they simple havent implemented it yet
You seem to be right. Here's the llvm's page with C++17 status, and the
{inclusive, exclusive}_scanpart was last updated in 2016 and hasn't been marked complete. I couldn't find GCC's stdlib page but I expect similar disappointment from them