相关疑难解决方法(0)

用户定义的可变参数字符模板的文字

最近,在gcc-trunk中实现了"用户定义的文字".请告诉我,我是否正确理解我无法为可变参数字符模板定义"用户定义的文字"?

template<char... chars>
int operator"" _call() { return sizeof...(chars); }
...
std::cout << "method"_call;
Run Code Online (Sandbox Code Playgroud)

向上.

我不明白为什么允许这个表达式:

template<char... chars>
int operator"" _call() { return sizeof...(chars); }
...
std::cout << 12345566_call;
Run Code Online (Sandbox Code Playgroud)

这个是不允许的:

template<char... chars>
int operator"" _call() { return sizeof...(chars); }
...
std::cout << method_call;
Run Code Online (Sandbox Code Playgroud)

重点是什么?

向上. 这是因为含糊不清?

谢谢.

c++ variadic-templates c++11

1
推荐指数
1
解决办法
1428
查看次数

标签 统计

c++ ×1

c++11 ×1

variadic-templates ×1