multimap-max_size

////////////////////////////////////////
//      2018/05/04 21:33:23
//      multimap-max_size

// the maxinum number of elements that the maltimap can hold 
#include <iostream>
#include <map>
#include <functional>

using namespace std;

int main(){
    typedef multimap<int, char, greater<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++;
    }
    cout << "size of multimap 'm'" << m.size() << endl;
    cout << "max_size of 'm' " << m.max_size() << endl;

    return 0;
}


/*
OUTPUT:
    m:
    3-C
    2-B
    1-A
    size of multimap 'm'3
    max_size of 'm' 178956970
*/ 
posted @ 2018-05-04 22:07  老耗子  阅读(45)  评论(0编辑  收藏  举报