Searching and Inserting in a map with 3 elements in C++
c++, stl
Solution
A `map` can only map one key type to one data type. If the data contains 2 elements, use a struct or a `std::pair`.
typedef std::map<int, std::pair<float, char> > Maptype;
...
Maptype m;
m[123] = std::make_pair(0.5f, 'c');
...
std::pair<float, char> val = m[245];
std::cout << "float: " << val.first << ", char: " << val.second << std::endl;
Problem
I need to have a map like this : ``` typedef std::map<int, float , char> Maptype ; ``` What is the syntax to insert and searching elements of pair in this map.