I want to experiment with the C++20 experimental ranges library. I tried to search around to see whether it is implemented in GNU Compiler Collection (GCC) 6.2 or above but did not find any information. Is the range library implemented in GCC?
I have not found any official documentation stating that GCC supports the experimental Ranges TS so far, so the answer seems to be negative.
As an additional note, Eric Niebler has a "reference" implementation for Ranges, you can find it on github.
The code is known to work on the following compilers:
- clang 3.6.2 (or later)
- GCC 4.9.4 (or later) (C++14 support requires GCC 5.2; C++14 "extended constexpr" support is poor before 6.1.)
- "Clang with Microsoft CodeGen" (Clang/C2) VS2015 Update 3 (or later)
The Ranges library is separate from GCC, though GCC is currently the only compiler that supports Ranges. Eric Niebler’s range-v3 library is very useful, but it is very different from the Ranges TS. The library that did implement the Ranges TS is called cmcstl2, mainly written by Casey Carter, with many contributions from Eric Niebler too. It has actually existed since 2015.
This library is header-only, and you only need to add its include directory to your include path. I define a bash alias for its quick use (you may want to do something similar):
alias gconcepts='g++ -fconcepts -std=c++17 -I$HOME/cmcstl2/include'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With