According to this page, the “One Ranges Proposal” is ready in Clang 15. I downloaded a binary release of clang+llvm from github here.
But, trying an example from cppreference.com:
#include <iostream>
#include <ranges>
#include <algorithm>
int main() {
for (int i : std::ranges::iota_view{1, 10})
std::cout << i << ' ';
std::cout << '\n';
for (int i : std::views::iota(1, 10))
std::cout << i << ' ';
std::cout << '\n';
}
With compile command:
% SYSR=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk
% clang++ -isysroot $SYSR -std=c++2b hello.cc
hello.cc:7:40: error: expected ')'
for (int i : std::ranges::iota_view{1, 10})
^
hello.cc:7:9: note: to match this '('
for (int i : std::ranges::iota_view{1, 10})
^
hello.cc:7:31: error: no member named 'iota_view' in namespace 'std::ranges'
for (int i : std::ranges::iota_view{1, 10})
~~~~~~~~~~~~~^
hello.cc:11:23: error: no member named 'views' in namespace 'std'
for (int i : std::views::iota(1, 10))
~~~~~^
3 errors generated.
Is there a compiler flag to turn it on?