为什么GCC不允许默认参数?为什么C++不允许这个默认值?
template<class edgeDecor, class vertexDecor, bool dir>
Graph<edgeDecor,int,dir> Graph<edgeDecor,vertexDecor,dir>::Dijkstra(vertex s, bool print = false) const
{
这是输出我得到:
graph.h:82: error: default argument given for parameter 2 of ‘Graph<edgeDecor, int, dir> Graph<edgeDecor, vertexDecor, dir>::Dijkstra(Vertex<edgeDecor, vertexDecor, dir>, bool)’
graph.h:36: error: after previous specification in ‘Graph<edgeDecor, int, dir> Graph<edgeDecor, vertexDecor, dir>::Dijkstra(Vertex<edgeDecor, vertexDecor, dir>, bool)’
任何人都可以明白为什么我得到这个?
我看不出为什么你得到这个,因为你只包括相关代码的一部分。你的错误同时涉及第36行和第82行,所以你需要在问题中包括这两个。 – 2010-03-23 00:35:59
对不起布鲁克斯,好点。第36行是我班的函数原型。 – 2010-03-23 04:35:09