boostorg / histogram

Fast multi-dimensional generalized histogram with convenient interface for C++14
Boost Software License 1.0
315 stars 73 forks source link

[Fix] add language feature-macro for <span> for detail::span #271

Closed JonasToth closed 4 years ago

JonasToth commented 4 years ago

This commit fixes an issue with newer clang/libc++-versions supporting C++2a. When compiling in C++17 (or earlier) mode, the compiler and libc++ do not expose the <span> include. The logic for detail::span to include <span> instead of providing an own implementation does only check if the include <span> exists. It exists, but it is not exposed. Therefore the compilation fails without this fix complaining about the missing span.

Fixes #270

henryiii commented 4 years ago

This macro is supposed to be defined in <span>, so the check needs to be a little more complex. It should happen after the include.

HDembinski commented 4 years ago

Thank you very much. The failing test is unrelated to this patch, I will look into it tonight and patch this and then merge.

HDembinski commented 4 years ago

This macro is supposed to be defined in <span>, so the check needs to be a little more complex. It should happen after the include.

According to the docs, https://en.cppreference.com/w/cpp/utility/feature_test we need to include either <version> or <span> to have the feature test macro, <version> seems to be more straight forward, but also has to be protected with a __has_include. So yes, this test needs to be more complex.

HDembinski commented 4 years ago

@JonasToth It turns out I already had a fix for this in my private fork, which I had forgotten to upload to the main repository. I updated the develop branch now which has the fix for this issue.

JonasToth commented 4 years ago

Perfect, thank you! I didnt had time to recheck yet, but as its fixed now, even better :)

Do you know, when the next boost-release will be?

HDembinski commented 4 years ago

Next release is in April https://github.com/boostorg/wiki/wiki/Releases%3A-Schedule