Question

The Code:

    boost::unordered_map<int, boost::unordered_map<int, float>> map;
{
    boost::unordered_map<int, float> h;
    h.insert(make_pair(1, 0.5));
    map.insert(make_pair(5, h));
}
{
    boost::unordered_map<int, float> h = map[5];
    h.insert(make_pair(2, 0.6));
    map.insert(make_pair(5, h));
}
cout << map[5].size() << endl;

Why the output is 1 not 2? And when i use boost::unordered_map* > instead, then everything works well. Can anyone help me?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top