On Sun, Aug 22, 2021 at 10:29 PM Robert Ramey via Boost < boost@lists.boost.org> wrote:
Yes.... but the function should really return the same value in both constexpr and runtime usage.
LOL - for me, the whole point of this is to use a different value depending on whether or not the value is known at compile time. Maybe someone wants to opine on this.
I think it would help discussion if you or John could provide a complete use case when different result is desired for a function depending on if it is running at compile time or not? I never had the need for different result based on if function is running at compile time, I have read the paper that proposed std::is_constant_evaluated ( http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0595r2.html ), and I did not find that example, except maybe their mention of constexpr std::string, but I presume that is mostly hacks to go around constexpr limitations, I think they still want to to implement same logic for std::string.