说我有三个文件
//first.h
typedef typename std::map<Vertex_t*,Vd_t> MapVertexVd_t;
//the graph class and ...
//other useful things related to a graph class
//second.h
#include "first.h"
class analyzeGraph {
MapVertexVd_t mapVertexVd;
public:
void fillMap();
};
//second.cpp
#include "second.h"
void analyzeGraph::fillMap()
{
//
}
Run Code Online (Sandbox Code Playgroud)
现在问题是我应该放置:
typedef typename std::map<Vertex_t*,Vd_t> MapVertexVd_t;
Run Code Online (Sandbox Code Playgroud)
在文件second.h和second.cpp中为了清楚起见.我觉得我会在一段时间后感到困惑,因为我的代码中有太多的typedef和typename.
我发现根据具体情况,这些方法很有效: