0
template <class T>
class Edge;
template <class T>
class Vertex;
template <class T>
class Vertex
{
T key;
char color;
std::vector<Edge> adjVertices;
};
template <class T>
class Edge
{
Vertex* source;
Vertex* target;
};
給我錯誤行:std::vector<Edge> adjVertices;
error: error C2143: syntax error : missing ';' before '<'
見參考文獻類模板實例'ds::Vertex<T>'
正在編制。C2143嵌套模板類
我應該改變什麼?
1同樣地,在C++ 03的情況下應該有之間的空間>>:標準::矢量> adjVertices';' –
2011-06-12 13:41:30
@dark_charlie:除非你的C++ 03編譯器支持它作爲擴展。 MSVS> = 2005(OP的編譯器)。 – ybungalobill 2011-06-12 14:30:49
@ybungalobill:爲什麼不只是添加空間使其成爲有效的C++而不依賴於特定的工具鏈進行編譯? – 2011-06-12 14:47:27