且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何显示地图内容?

更新时间:2023-11-18 12:48:10

Well it depends on how you want to display them, but you can always iterate them easily:

typedef map<string, list<string>>::const_iterator MapIterator;
for (MapIterator iter = mapex.begin(); iter != mapex.end(); iter++)
{
    cout << "Key: " << iter->first << endl << "Values:" << endl;
    typedef list<string>::const_iterator ListIterator;
    for (ListIterator list_iter = iter->second.begin(); list_iter != iter->second.end(); list_iter++)
        cout << " " << *list_iter << endl;
}

相关阅读

推荐文章