Niel de Wet
Niel de Wet

Reputation: 8408

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.

Upvotes: 1

Views: 146

Answers (1)

Tadeusz Kopec for Ukraine
Tadeusz Kopec for Ukraine

Reputation: 12413

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

Upvotes: 10

Related Questions