[prev in list] [next in list] [prev in thread] [next in thread]
List: boost
Subject: Re: [boost] is_constant_evaluated
From: John Maddock via Boost <boost () lists ! boost ! org>
Date: 2021-08-11 8:14:12
Message-ID: c145dd8d-b230-2855-34d2-5858da49c2b8 () googlemail ! com
[Download RAW message or body]
> 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
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic