GCC似乎认为我正在尝试在模板函数签名中进行函数调用。谁能告诉我以下内容有什么问题吗?
227 template<class edgeDecor, class vertexDecor, bool dir>
228 vector<Vertex<edgeDecor,vertexDecor,dir>> Graph<edgeDecor,vertexDecor,dir>::vertices()
229 {
230 return V;
231 };
GCC正在提供以下内容:
graph.h:228: error: a function call cannot appear in a constant-expression
graph.h:228: error: template argument 3 is invalid
graph.h:228: error: template argument 1 is invalid
graph.h:228: error: template argument 2 is invalid
graph.h:229: error: expected unqualified-id before ‘{’ token
非常感谢。
最佳答案
您应该在两个>
之间放置空格。 >>
被解析为位移运算符,而不是两个右括号。