map-begin

////////////////////////////////////////
//      2018/04/30 12:14:50
//      map-begin

// returns an iterator to the first element
#include <iostream>
#include <map>

using namespace std;

int main(){
    typedef map<int, char, less<int>> M;
    typedef M::value_type v_t;
    M m;

    m.insert(v_t(2,'B'));
    m.insert(v_t(3,'C'));
    m.insert(v_t(1,'A'));

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


/*
OUTPUT:
    m:
    1-A
    2-B
    3-C
*/ 
原文地址:https://www.cnblogs.com/laohaozi/p/12537863.html