map >: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.


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM