C++函数模板偏特化问题较为美观的一种解决方案 使std::enable_if_t作为int并带上默认值 template <typename T, typename std::enable_if_t<std::is_integral_v<T>, int> = 0> void foo(T x) {