Question
Do we have C++20 ranges library in GCC 9?
Do we have support for C++20 ranges library in the newly released GCC 9?
I copied the example code below for ranges library from: https://en.cppreference.com/w/cpp/ranges
#include <vector>
#include <ranges>
#include <iostream>
int main()
{
std::vector<int> ints{0,1,2,3,4,5};
auto even = [](int i){ return 0 == i % 2; };
auto square = [](int i) { return i * i; };
for (int i : ints | std::view::filter(even) | std::view::transform(square)) {
std::cout << i << ' ';
}
}
But when compiled with g++ 9.1 (Ubuntu 18.04 LTS (Bionic Beaver)), it complains that <ranges>
cannot be found:
$ g++ -std=c++2a cpp2a.cpp
cpp2a.cpp:2:10: fatal error: ranges: No such file or directory
2 | #include <ranges>
| ^~~~~~~~
compilation terminated.
Am I missing something?
And will the ranges library arrive at some point of time with the GCC 9 series?