简体   繁体   中英

Can you have an array of maps in C++?

If so how? Because currently trying to handle input for multiple players using a map of actions.

std::vector<std::map<a,b> >

or if you want to handle the construction/destruction yourself

std::vector<std::map<a,b>* >

where a and b are the keys/values in your map

For example:

#include <vector>
#include <map>

int main(int argc, char* argv[])
{
   std::vector<std::map<int,int>> vecOfMaps;
   std::vector<std::map<int,int>*> vecOfMaps2;
   return 0;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM