Dictionary 在映射中插入对
为了一张地图Dictionary 在映射中插入对,dictionary,tree,insert,Dictionary,Tree,Insert,为了一张地图 map<int,pair<int,int>>m; mapm; 下面这行行行得通 m[level]=pair<int,int>(h,root->data); //root is a pointer to a node in tree m[level]=对(h,根->数据)//根是指向树中节点的指针 但下面的人没有 m.insert(pair<int,pair<int,int>>(level,(h,r
map<int,pair<int,int>>m;
mapm;
下面这行行行得通
m[level]=pair<int,int>(h,root->data); //root is a pointer to a node in tree
m[level]=对(h,根->数据)//根是指向树中节点的指针
但下面的人没有
m.insert(pair<int,pair<int,int>>(level,(h,root->data)));
m.insert(成对(级别,(h,根->数据));
为什么??< P/> < P>我建议在线程中添加C++标记。使用std::make_pair进行配对。实际上,不建议使用
使用名称空间std代码>
它不编译还是不工作?@pesuww它甚至不编译。
m.insert(std::make_pair(level, std::make_pair(h, root->data)))