I would like to have a data structure similar to std::map
with multiple key levels. For example in this my_map :
(‘a’ , “a1”) -> “value1”
(‘a’ , “a2”) -> “value2”
(‘b’ , “b1”) -> “value3”
(‘b’ , “b2”) -> “value4”
The first level key values are chars: ['a' and 'b']
and the second key levels are std::string
("a1", etc) and the values are strings.
API requirements:
Adding elements using two key values.
Retrieve elements by the first key: my_map.at_first_level('a')
, this should return a map like:
"a1" -> “value1”
"a2" -> “value2”
Is this "multi-level map" data structure implemented in any of the C++ libraries?