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.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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_mapcan 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: