map<string,map<string,string>>:map中map用法示例

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.
posted @ 2012-04-10 14:27  likebeta  阅读(10140)  评论(0编辑  收藏  举报