views:

79

answers:

1

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.

+10  A: 

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

Tadeusz Kopec
Note that this will no longer be necessary in C++0x or whatever they decide to call the final standard
John Burton
Thanks Tadeusz!
nieldw
@JB: C++11 from the latest Herb Sutter's column :)
Matthieu M.
@Matthieu: Effectively he said that, if all goes well, we *should* end up with C++11. But it seems its spreading already.
Georg Fritzsche
Of course it is! We've been waiting for so long that his announce was bound to be taken at face value ;) Though I'll kind of miss the `0x`, it was neat I think, kind of futurist.
Matthieu M.