开发者

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

开发者 https://www.devze.com 2023-02-25 15:04 出处:网络
If so how? Because currently trying to handle input for mu开发者_运维问答ltiple players using a map of actions.std::vector<std::map<a,b> >

If so how? Because currently trying to handle input for mu开发者_运维问答ltiple 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;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消