我知道当我们在另一个模板中使用模板时,我们应该这样写:
I know that when we are using template inside another template, we should write it like this:
vector
如果我们在没有空格的情况下编写它:
and if we write it without the whitespace:
vector
我们会得到一个错误:
`>>' 应该是嵌套模板参数列表中的 `> >'
`>>' should be `> >' within a nested template argument list
我认为这是可以理解的,但我不禁想知道,在哪些情况下这真的是模棱两可的?
I see this is understandable, but I just can't help but wondering, in which cases will this be really ambiguous?
有时您希望它是 >>.考虑
boost::array<int, 1024>>2> x;
在 C++03 中,这成功解析并创建了一个大小为 256 的数组.
In C++03 this successfully parses and creates an array of size 256.
这篇关于模板中的模板:为什么是“`>"应该是`>>'在嵌套的模板参数列表中"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
std::reference_wrapper 和简单指针的区别?Difference between std::reference_wrapper and simple pointer?(std::reference_wrapper 和简单指针的区别?)
常量之间的区别.指针和引用?Difference between const. pointer and reference?(常量之间的区别.指针和引用?)
c++ - 如何从指向向量的指针访问向量的内容?How to access the contents of a vector from a pointer to the vector in C++?(c++ - 如何从指向向量的指针访问向量的内容?)
*& 的含义和**&在 C++ 中Meaning of *amp; and **amp; in C++(*amp; 的含义和**amp;在 C++ 中)
为什么我不能对普通变量进行多态?Why can#39;t I do polymorphism with normal variables?(为什么我不能对普通变量进行多态?)
取消引用已删除的指针总是会导致访问冲突?Dereferencing deleted pointers always result in an Access Violation?(取消引用已删除的指针总是会导致访问冲突?)