Is there a workaround to do something like this?
if constexpr (std::floating_point<T>) {}
else if constexpr (std::integral<T>) {}
...
else static_failure("Feature expansion needed");
because if I replace static_failure with static_assert, it needs the replication of all the above conditions (they are many and complicated) and it becomes ugly.
// It does not work properly: always fail
else static_assert(false, "Feature expansion needed");
// works fine, but it is ugly
else static_assert(std::floating_point<T> || std::integral<T> || ... || ... || ..., "Feature expansion needed");
I do not prefer a runtime behavior like:
throw "Feature expansion needed";
always_false<T>as workaround tostatic_assertissues. That's being said, you'd better put the full requirement as a requirement in the declaration of the function rather than usestatic_assertto notify that these conditions fail.static_assert(false).