嵌套std :: map使用指针 [英] nested std::map using pointers
本文介绍了嵌套std :: map使用指针的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在地图中使用地图,并想要访问第二张地图中的特定成员。
I am using a map inside a map and want to access a specific member in the second map.
std::map<int, std::map<DWORD,IDLL::CClass*>*> MyMap
推荐答案
尝试
auto outerIt = MyMap.find(someInt);
if(outerIt != MyMap.end()) {
auto innerIt = (*outerIt)->find(someDWord);
if(innerIt != (*outerIt)->end()) {
auto yourElement = *innerIt;
}
}
这篇关于嵌套std :: map使用指针的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文