#include #include #include #include #include #include using namespace std; // begin(): Returns a random-access iterator to the first element in the container. // end(): Returns a random-access iterator that point just beyond the end of // the map. // rbegin() Returns an iterator to the first element in a reversed map. // rend() Returns an iterator to the end of a reversed map. // clear(): Erases the elements of the map. // empty(): Tests if the map container is empty. // erase() Removes an element or a range of elements in a map from specified positions. // insert() Inserts an element or a number of elements into the map at a specified position. // max_size() Returns the maximum length of the map. // count() Returns the number of elements in a map whose key matches a parameter-specified key. // equal_range() Returns an iterator that addresses the location succeeding the last element in a map. // find() Returns an iterator addressing the location of an element in a map that has a key equivalent to a specified key. // max_size() Returns the maximum length of the map. // size() Specifies a new size for a map. // swap() Exchanges the elements of two maps. int main() { map mp; mp["a"]=10; mp["d"]=1; mp["aa"]=5; map::iterator mpitr; for ( mpitr = mp.begin(); mpitr != mp.end(); ++mpitr ) cout << mpitr->first << " " << mpitr->second << endl; if (mp.find("b") != mp.end()) cout << "YES" << endl; if (mp.find("d") == mp.end()) cout << "NO" << endl; }