I know that I can create a multi-dimensional map by nesting maps together, e.g.:
// Two-dimensional key
map<string, map<int, double> > m;
so it is easy to extract all of the values associated to the highest order key. So if I have a set of data that looks like this:
A1 : 23.0
A2 : 45.3
A5 : 5.88
B9 : 7.2
B10 : 79.74
I could store it as std::map<std::string, std::map<uint, float>> mymap
and easily retrieve all of the A
values by doing mymap["A"]
.
I also know I can create a std::map
with multiple keys by using a std::tuple
, which is more intuitive:
std::map<std::tuple<std::string,uint>, float> mymap
but is there a c++14
way to get all of the A
elements with this second implementation?