我知道当我们在另一个模板中使用模板时,我们应该这样写:
vector<pair<int,int> > s;
如果我们写的时候没有空格:
vector<pair<int,int>> s;
我们会得到一个错误:
`>>' should be `> >' within a nested template argument list
我认为这是可以理解的,但我不禁想知道,在什么情况下这真的是模棱两可的?
最佳答案
有时你希望它是>>
。考虑
boost::array<int, 1024>>2> x;
在 C++03 中,这成功地解析并创建了一个大小为 256
的数组。
关于c++ - 模板内的模板 : why "` >>' should be ` > >' within a nested template argument list",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6695261/