Constexpr if alternative
问题 I would like to use constexpr if to branch at compile time, but it does not seem to be supported by the latest MSVC compiler. Is there an alternative to the following?: template<typename T> void MyFunc() { if constexpr(MeetsConditions<T>::value) { FunctionA<T>(); } else { FunctionB<T>(); } } In short: Can I simulate constexpr if when it is not supported by the compiler? 回答1: One of pre-C++17 ways is to use partial template specializations, like here: template <template T, bool AorB> struct