Map as a source of data

Hello everybody,
I've got a console project generating 6 elements combinations of strings(6 out of 10)for example:
ia11,ia72,ia190,ia21,ia102,ia180
ia11,ia72,ia167,ia64,ia102,ia178
etc...
(altogether 210 combinations)
I've also got a map:
typedef map<string,vector<int> >container;
container::iterator it;
container map;
map.insert(make_pair("ia11", via11));
map.insert(make_pair("ia34", via34));
map.insert(make_pair("ia72", via72));
map.insert(make_pair("ia167", via167));
map.insert(make_pair("ia190", via190));
map.insert(make_pair("ia21", via21));
map.insert(make_pair("ia64", via64));
map.insert(make_pair("ia102", via102));
map.insert(make_pair("ia178", via178));
map.insert(make_pair("ia180", via180));
The map has also string keys(the same as in the console output in order to make comparison possible).
That's because I want to populate the console output with integer values from the map vectors.
In other words the map is the source of data for the output. To put it in other way: when we've got ia21 in the output, the programme should compare it to the map and find a string key in the map (which is ia21 too) and after that insert values of integer from the vector(value in the map)into the string output.
What is the simpliest way to do it? What classes, compare functions or bool operators should I use?
I would be grateful for any kind of help!
To get data from map, you can use .find():
http://www.cplusplus.com/reference/stl/map/find/
I know that find is possible, but in the example you quoted:
// map::find
#include <iostream>
#include <map>
using namespace std;

int main ()
{
map<char,int> mymap;
map<char,int>::iterator it;

mymap['a']=50;
mymap['b']=100;
mymap['c']=150;
mymap['d']=200;

it=mymap.find('b');
mymap.erase (it);
mymap.erase (mymap.find('d'));

// print content:
cout << "elements in mymap:" << endl;
cout << "a => " << mymap.find('a')->second << endl;
cout << "c => " << mymap.find('c')->second << endl;

return 0;
}

...you must do it ,let us say,"manually". You find only one value for a string key at a time. I've got the whole set of string combinations to find(210 combinations*6 strings in each combination and what's more the same strings repeat many times) . I guess some kind of template is needed here.
Topic archived. No new replies allowed.