我不知道如何獲取地圖的內容。 您可以打印最內層地圖的內容,如下所示([DEMO]): auto beg = debut->second.second.cbegin();auto end = debut->second.second.cend();while(beg!=end) //can also use for loop{ std::cout<<beg->first<<" "; std::cout<<beg->second<<std::endl; ++beg;} 以下是一個更完整的示例,用于打印地圖的所有內容,僅供演示: #include <iostream>#include <map>int main(){ std::map<std::string,std::pair<int,std::map<std::string,int>>> m{ { "first", { 5, {{"a", 10}, {"b", 20}} }} , { "second", { 6, {{"c", 100}, {"d", 200},{"e", 300} }}}, { "third", { 7, {{"f", 400}} } }}; /////////////////////