1
먼저이 질문과 관련된 이전에 묻는 모든 질문을 읽었지만 문제를 해결할 수 없었습니다. 나는 하나의 3D지도, 지금은 이런 식으로 가치를 삽입 한 3D지도에서 값 삽입 및 읽기
map<int,map<const char*, const char*>> map3D;
map<const char*, const char*> submap;
는 INT의 값의 최대가
5
입니다을 가지고 있지만 각각의 int 값에 대한 서브맵
50 key and value
있다.
I는 50 개 이상의 값 것이다 TEMP1과 TempB 증가 후 값이 될
submap.insert(std::pair<const char*,const char*>(TempA, TempB));
map3D.insert(pair<int,map<const char*,const char*>>(count,submap));
카운트 값과 같은 값을 삽입 하였다. 이제 나는 값을 다시 읽고 싶다. 그리고 나는이 질문에서 언급 한 것처럼 이렇게하고있다. How to loop through a C++ map of maps?.
std::map<int,map<const char*,const char*>>::iterator out_it;
for(out_it =map3D.begin();out_it != map3D.end();++out_it)
{
for(std::map<const char*, const char*>::const_iterator in_it=out_it->second.begin();in_it != out_it->second.end(); ++in_it)
std::cout << in_it->first << " => " << in_it->second <<endl;
}
int는 5이므로 TempA와 TempB의 값은 5 개뿐입니다. 서브맵에서만 반복하는 경우 모든 값을 표시합니다.
for(std::map<const char*, const char*>::const_iterator in_it=submap.begin();in_it != submap.end(); ++in_it)
std::cout << in_it->first << " => " << in_it->second <<endl;
Can 모든 사용자가 모든 값을 읽을 수있는 방법을 안내해줍니다. 감사합니다