Hi all
Having probs updating the key of a multimap record. I've tried various examples from here and there but no luck using mingw 3.4.2 Everything apart from update of key works (insert, erase, find ...) So below a simplified example, with between commented asterisks just one of my attempts of where the problem is.
As always any guidance greatly appreciated
Code:/*
Testing maps
*/
#include <iostream>
#include <sstream>
#include <fstream>
#include <stdio.h>
#include <string.h>
#include <list>
#include <string>
#include <time.h>
#include <map>
#include <vector>
#include <conio.h>
using namespace std;
int main(int argc, char *argv[])
{
typedef map <string, string> MAP_STRING_MESSAGE;
typedef multimap <string, string> MMAP_STRING_MESSAGE;
MAP_STRING_MESSAGE::iterator ilocator1;
MAP_STRING_MESSAGE::iterator findlocator1;
MAP_STRING_MESSAGE amap;
amap.insert(make_pair("first","One"));
amap.insert(make_pair("second","Two"));
amap.insert(make_pair("third","Three"));
for ( ilocator1 = amap.begin(); ilocator1 != amap.end(); \
++ ilocator1 )
{
cout << ilocator1->first << "\n";
cout << ilocator1->second << "\n";
cout << "____________________________\n";
}
findlocator1 = amap.find("second");
// ************************
findlocator1->first = "fourth";
// ************************
for ( ilocator1 = amap.begin(); ilocator1 != amap.end(); \
++ ilocator1 )
{
cout << ilocator1->first << "\n";
cout << ilocator1->second << "\n";
cout << "____________________________\n";
}
getch();
}