Vis*_*iva 5 c++ templates constants
可以说我有一个模板:
template<char const *str>
class Template { ... };
Run Code Online (Sandbox Code Playgroud)
为什么不能写出下面的内容呢?
Template<"literal"> T;
Run Code Online (Sandbox Code Playgroud)
或者
char const *s = "Literal";
Template<s> T;
Run Code Online (Sandbox Code Playgroud)
为什么下面的方法有效?
char const s[] = "Literal";
Template<s> T;
Run Code Online (Sandbox Code Playgroud)