Tom*_*miT 10 c++ syntax whitespace c++11 template-aliases
这是另一种情况,其中空白在C++中很重要,还是编译器错误?以下代码在语法上是否正确?
#include <type_traits>
template <bool cond>
using EnableIf = typename std::enable_if<cond, int>::type;
template <int n, EnableIf<n == 1>=0>
void func()
{}
Run Code Online (Sandbox Code Playgroud)
英特尔C++编写器无法编译它:"类型说明符的无效组合".但是在签名中添加单个空格并且它编译得很好:
template <int n, EnableIf<n == 1> =0>
void func()
{}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
515 次 |
| 最近记录: |