multimap-begin

////////////////////////////////////////
//      2018/05/02 18:38:58
//      multimap-begin

#include <iostream>
#include <map>
#include <string>

using namespace std;

int main(){
    typedef multimap<string, int> M;
    typedef M::value_type v_t;
    M m;

    m.insert(v_t("first",100));
    m.insert(v_t("second",200));
    m.insert(v_t("third",300));
    m.insert(v_t("four",400));
    m.insert(v_t("third",500));

    cout << "m:" << endl;
    M::iterator it = m.begin();
    while (it != m.end()){
        cout << it->first << "-" << it->second << endl;
        it++;
    }
    return 0;
}


/*
OUTPUT:
    m:
    first-100
    four-400
    second-200
    third-300
    third-500
*/ 
posted @ 2018-05-02 19:44  老耗子  阅读(52)  评论(0编辑  收藏  举报