////////////////////////////////////////
//      2018/05/01 14:22:47
//      map-empty

// true if the map is empty
#include <iostream>
#include <map>

using namespace std;

int main(){
    typedef map<int, int> M;
    M m;

    m[1] = 100;
    m[3] = 200;
    m[5] = 500;

    cout << "values of map 'm':";
    M::iterator it = m.begin();
    while (it != m.end()){
        cout << it->second << " ";
        it++;
    }
    cout << endl;

    cout << "size of map = " << m.size() << endl;
    cout << "map 'm' is " << (m.empty() ? "" : "not ") << "empty." << endl;

    m.erase(m.begin(), m.end());
    cout << "After m.erase(m.begin(), m.end())" << endl;

    cout << "size of map = " << m.size() << endl;
    cout << "map 'm' is " << (m.empty() ? "" : "not ") << "empty." << endl;

    return 0;
}


/*
OUTPUT:
    values of map 'm':100 200 500
    size of map = 3
    map 'm' is not empty.
    After m.erase(m.begin(), m.end())
    size of map = 0
    map 'm' is empty.
*/