1
GCC似乎認爲我正在嘗試在我的模板函數簽名中進行函數調用。任何人都可以告訴我以下哪些問題?爲什麼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
非常感謝。
請注意,這將不再需要在C++ 0x或任何他們決定調用最終的標準 – jcoder 2010-03-22 11:43:47
謝謝Tadeusz! – 2010-03-22 12:53:05
@JB:C++ 11來自最新的Herb Sutter的專欄:) – 2010-03-22 16:01:49