ericniebler / range-v3

Range library for C++14/17/20, basis for C++20's std::ranges
Other
4.06k stars 437 forks source link

GCC and std=c++20 flag, ambiguous #1735

Closed ghost closed 1 year ago

ghost commented 1 year ago

Hi,

How can I get rangev3 to work with gcc 12.2 and the std=c++20 flag?

I cannot decrease the standard requirement and I need the cyclic view. I am willing to dump the std::ranges in favor of v3.

Please have a look at the issue I am talking about: godbolt link

Thanks

dvirtz commented 1 year ago

As you can see in the compiler output, there's an ambiguity between std::ranges and (range-v3) ::ranges namespaces. If you drop the using namespace std; statement it will unambiguously choose range-v3's namespace. https://godbolt.org/z/5rac63M5G

ghost commented 1 year ago

Thanks, So no way to keep the using namespace std? No workaround?

dvirtz commented 1 year ago

The other solution is to fully qualify using namespace ::ranges; https://godbolt.org/z/5d1fT7E7r

ghost commented 1 year ago

Great, thank you !