map>:map中map用法示例

时间:2021-08-29 19:11:23
include <iostream>
#include <map>
using namespace std;
int main()
{
    map<string,map<string,string> > mapmaps;
    map<string,string> mapmap;
    mapmap.insert(pair<string,string>("ysl","ysh"));
    mapmaps.insert(pair<string,map<string,string> >("ysy",mapmap));

    cout<<mapmaps.begin()->first<<endl;
    cout<<mapmaps.begin()->second.begin()->first<<endl;
    cout<<mapmaps.begin()->second.begin()->second<<endl;
    return 0;
}
结果:

ysy
ysl
ysh

Process returned 0 (0x0) execution time : 0.250 s
Press any key to continue.