现在,我想使用泛型来捕获类型: return input + 2;如果我想使用它捕获参数的隐式类型,我可以这样做Operator '+' cannot be applied to types 'T' and '2'.`
正如您所看到的,TypeScript返回一个关于类型和+运算符的错误,我不明白为什么。如果我显式地设置
我试图在编译时在模板函数中确定类型T是基元类型还是具有基础基元类型的枚举。在代码中,我试图这样做bool foo(T& input) bool isPrimitive = std::is_fundamentalreturn isPrimitive; //return this value just to avoid warning