boostorg / container

STL-like containers from Boost
http://www.boost.org/libs/container/
Boost Software License 1.0
96 stars 116 forks source link

Fixes #195: Only allowing typedef iterator_concept in C++20 #196

Closed TristanFloch closed 2 years ago

TristanFloch commented 2 years ago

Fixes #195.

I was a bit surprised that there were no better way to check if the standard was C++20. Please correct me if there is.

theodelrieu commented 2 years ago

Any news on this?

TristanFloch commented 2 years ago

Any news on this?

None yet.

pdimov commented 2 years ago

The relatively new BOOST_CXX_VERSION is what one uses nowadays, if no appropriate Config or feature macro exists.

pdimov commented 2 years ago

In this case, the feature test macro that controls whether <iterator> has the new tags and iterator_concept seems to be __cpp_lib_ranges. (<iterator> must have been included beforehand.)

igaztanaga commented 2 years ago

In this case, the feature test macro that controls whether <iterator> has the new tags and iterator_concept seems to be __cpp_lib_ranges. (<iterator> must have been included beforehand.)

In theory, for C++20 features we could also check if header exists and if so, check for __cpp_lib_ranges, I guess.

pdimov commented 2 years ago

Checking for header existence is pretty useless in practice, as the header might exist but be empty or generate an #error. Fortunately, there's no need for that here, because <iterator> always exists.