简体   繁体   English

Solaris C ++流输入>>操作员和模板模板

[英]Solaris C++ stream input >> operator and templates of templates

I there a compiler option I could use in CC compiler to get the following code (which compiles fine in Visual C++) 我有一个编译器选项,我可以在CC编译器中使用以获取以下代码(在Visual C ++中编译良好)

std::vector<std::vector<double>> v2;

without the following error 没有以下错误

Error: "," expected instead of ">>" 错误:“,”而不是“>>”

Try this : 尝试这个 :

std::vector<std::vector<double> > v2; //give a space between two '>'

" >> " is interpreted as the right shift operator and hence you get a compile time error. >> ”被解释为右移位运算符,因此您得到编译时错误。

This problem will be fixed in C++0x. 这个问题将在C ++ 0x中修复。 Have a look here . 看看这里

You need a space between the two greater-than signs: 你需要在两个大于号之间留一个空格:

std::vector<std::vector<double> > v2;

Otherwise, the ">>" is treated as a single token. 否则,“>>”被视为单个标记。

std::vector<std::vector<double> > v2;

你需要添加一个空格,否则它将被解释为>>运算符。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM