|
Boost Users : |
Subject: Re: [Boost-users] generalize boost macros
From: Robert Ramey (ramey_at_[hidden])
Date: 2019-02-02 20:19:18
On 2/2/19 11:37 AM, John Maddock via Boost-users wrote:
>> Hmm - I've heard that gcc already implements is_constant_evaluated().
>> Could be wrong though. In any case, the capability in the works for
>> HAS_IS_CONSTANT_EVALUATED? or similar? I think I could benefit from
>> it right now.
>
> I don't think it's in any released gcc version, but they are busy making
> use of it in libstdc++ development I believe, so it's on it's way. I'm
> hoping most compiler vendors will make it available in pre-C++20 mode as
> well. Ah wait, it's scheduled for gcc-9:
> https://gcc.gnu.org/projects/cxx-status.html#cxx2a
sounds promising.
>
> |__builtin_constant_p almost does what we need, but it's GCC only (clang
> supports it, but it doesn't do constexpr detection as it always returns
> the same value so far as I can tell).|
Damn - I was holding out hope for that.
>
> |There are some suggested gadgets here:
> https://stackoverflow.com/questions/13299394/is-is-constexpr-possible-in-c11
> which detect whether a function may be used in a constexpr context, but
> nothing that permits you to determine whether the current context is
> constexpr or not (one claim to the contrary not withstanding).
I looked at this carefully but wasn't convinced that it would do the job
for me. My interest is to make safe_literal unnecessary.
Robert Ramey
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net