我知道非类型模板参数应该是一个常量整数表达式.有人可以解释为什么会如此?
template <std::string temp>
void foo()
{
// ...
}
Run Code Online (Sandbox Code Playgroud)
Run Code Online (Sandbox Code Playgroud)error C2993: 'std::string' : illegal type for non-type template parameter 'temp'.
我理解常量积分表达式是什么.不允许非常量类型的原因是什么,如std::string上面的代码片段?