Here is the thing, I have several std::maps, like this:
std::map<int, std::set> map_1; std::map<int, std::string> map_2; std::map<int, long> map_3; ... And there are also several numbers, each of which relates to one map listed above, like
1 -> map_2 2 -> map_1 3 -> map_3 ... What I'm trying to do is that, put all the maps into one array, then access each number's map will be like accessing the element of that array, like this:
arr = [map_2, map_1, map_3]; // let x be a number map_x = arr[x]; do_something(map_x) This way, I can relieve myself of writing switch...case, right?
But can I put them together and how?
switch...case...map_xanddo_something()so that the assignment would work for all of the array elements?