Boost logo

Boost :

From: John Maddock (jz.maddock_at_[hidden])
Date: 2021-08-11 08:14:12


> I've looked at this and have a couple of questions:
>
> a) I see BOOST_NO_CXX20_IS_CONSTANT_EVALUATED and presume that's it's
> like all the other boost feature macros.  So far so good.
>
> This might return true or false independently of the C++ version being
> used.  That is, I could be compiling with C++14 and the macro might
> return true.  This might direct the generation of the most optimal
> code but that that code might be different depending on the compiler
> being tested.  I'm concerned about being able to test for
> portability/standards conformance.  So I'd like to be able to have
> BOOST_NO_CXX20_IS_CONSTANT_EVALUATED defined either in accordance with
> the standard version or with the actual compiler capability.  So I'd
> run my tests twice:
>
> 1) with the most efficient implementation.
> 2) with the standards conforming implementation.
>
> Assuming it passes 2) (al be it more slowly) I would know that my
> test/application could always be counted on to pass.
>
> I don't know if I explained myself well.
>
Not really ;)

BOOST_NO_CXX20_IS_CONSTANT_EVALUATED is defined if there is no
std::is_constant_evaluated() in type_traits: for all current
compilers/std libs that means real C++20 mode as well as compiler
intrinsic support.  In contrast BOOST_IS_CONSTANT_EVALUATED() works in
C++14/17 etc if the required intrinsic is present.

John.

-- 
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk