Can I use following syntax:
std::map<int,std::list<int>> mAllData;
Where Key Value(int) will be ID of data, and said data could have multiple types so storing all them against said key value. I am trying to use it.
Can I use following syntax:
std::map<int,std::list<int>> mAllData;
Where Key Value(int) will be ID of data, and said data could have multiple types so storing all them against said key value. I am trying to use it.
Your compiler may not support the two closing angle brackets being right next to each other yet, so you might need
std::map<int,std::list<int> > my_map
.With C++11
my_map
can be initialized more efficiently:Also, if you just want a way to store multiple values per key, you can use std::multimap.
And in C++11 this can be written: