On 5/08/2021 12:53 pm, Andrey Semashev wrote:
On 8/5/21 2:14 AM, Gavin Lambert wrote:
On 5/08/2021 7:03 am, Andrey Semashev wrote:
I might add that including
just to test got a feature macro is not good. It wouldn't be good in something like Boost.Config, no.
But if you're doing that check at actual point of use then you've almost certainly already included
anyway, so it's "free". No, not really. Not only because needing is_constant_evaluated does not equate to needing type traits or metaprogramming, but because if the macro check says "no" then you've included
for nothing.
Yes, really. That's the header in which std::is_constant_evaluated is defined (as well as the feature macro you're wanting to check), so if you're wanting to use it then you have to include the header anyway. There's not really any point in making the include itself conditional (even if you could), except perhaps on something more generic (such as "is C++11 or later", to detect cases when the header wouldn't exist).