Reputation: 19
map <int, int[]> miasta;
miasta[0] = { {1,2,3} };
What do I need to do If i want to make a dictionary that contains that gets int and you can assign many integers to one int because I want to make a graph in python I can just do that like this cities = {1 : {1,2,3}, 2: {1, 2, 3}} How do I do that in c++
Upvotes: 0
Views: 414
Reputation: 519
You probably want to use something like map<int, vector<int>>
or map<int, list<int>>
or map<int, deque<int>>
(see vector, list, and deque)
Addressing your comment you cannot directly cout a vector. You have to use a range based for-loop:
for(const auto& i: miasta[0])
std::cout << i << " ";
Upvotes: 1