I need a data container for collecting numeric data based on one or multiple keys (like a key built of int
and std::string
).
For one key, I simply can use unordered_map<std::string, int>
respectively unordered_map<std::string, List<int>>
if multiple values should be collected.
What about having multiple keys? Other posts suggested me to use std::make_pair<type1, type2>
as key, but this only works for 2 keys and looks a little hacky.
Is there any easy-to-use data structure or library allowing keys built of multiple variables and multiple values assigned to it? The values only must be accessible by the keys (I do not need something like boost::multi_index which provides several interfaces to access values). Furthermore the values must not be sorted in the container, however fast access is desired as the values are added/incremented during data processing.
Aucun commentaire:
Enregistrer un commentaire