Hi, I am dealing with a very unpleasant issue. I want to wrap compile-time known char arrays into a wrapper - and not-compile-time known strings into a different wrapper.
So, I would like to basically overload on if consteval
I was looking at the answer on SO here: https://stackoverflow.com/questions/76987078/is-it-possible-to-make-a-compile-time-evaluated-function-return-a-different-type
But it does not seem to actually work...
https://godbolt.org/z/fTvT8WT6W
So, my goal is to have an equivalent of:
template <size_t N>
wrapper1 foo(const char (&arg)[N]) { ... }
template <size_t N>
consteval wrapper2 foo(const char (&arg)[N]) { ... }
Is there any, standard or not, way to do it? I tried using __builtin_constant_p with no luck, as __builtin_choose_expr is not available in g++. Anything else failed so far
Is it possible, at compile time, to determine if a call to a function (a constexpr function mainly) is compile-time evaluated and than just make another version of that function (like what a template