Insert into multimap with key-value pair : multimap insert « map multimap « C++ Tutorial






#include <map>
#include <iostream>

using namespace std;

typedef map <int, string> MAP_INT_STRING;
typedef multimap <int, string> MMAP_INT_STRING;

int main ()
{
    MMAP_INT_STRING mmapIntToString;

    mmapIntToString.insert (MMAP_INT_STRING::value_type (3, "Three"));
    mmapIntToString.insert (MMAP_INT_STRING::value_type (45, "Forty Five"));

    cout << endl << "The multimap contains " << mmapIntToString.size ();
    cout << " key-value pairs." << endl;
    cout << "The elements in the multimap are: " << endl;


    return 0;
}








23.13.multimap insert
23.13.1.uses a multimap to store names and phone numbers.
23.13.2.Insert into multimap with key-value pair
23.13.3.Insert into multimap with make-pair function
23.13.4.Insert value pair to int, double multimap