所以这是我的代码片段:
struct dv_nexthop_cost_pair
{
unsigned short nexthop;
unsigned int cost;
};
map<unsigned short, vector<struct dv_nexthop_cost_pair> > dv;
Run Code Online (Sandbox Code Playgroud)
我收到以下编译器错误:
error: ISO C++ forbids declaration of `map' with no type
Run Code Online (Sandbox Code Playgroud)
宣布这个的正确方法是什么?
要么你忘了#include正确的标题,要么没有导入std名称空间.我建议如下:
#include <map>
#include <vector>
std::map<unsigned short, std::vector<struct dv_nexthop_cost_pair> > dv;
Run Code Online (Sandbox Code Playgroud)