开发者

Why does gcc think that I am trying to make a function call in my template function signature?

GCC seem to think that I am trying to make a function call in my template function开发者_运维问答 signature. Can anyone please tell me what is wrong with the following?

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 is giving the following:

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

Thanks a lot.


You should put space between two >. >> is parsed as a bit-shift operator, not two closing brackets.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜