0
for(auto& i : unorderedMap){
    cout << i.first << " " << cout << i.second << endl;
    cout << unorderedMap[i.first] << endl;
}

So this outputs

B2 0x6083e83
3  //B2 should be 3 instead of 0x6083e83
A2 0x6083e820
20 //A2 should be 20 instead of 0x6083e820

I thought the output should look like

B2 3
3   
A2 20
20  

B2 and A2 are keys, and i.second prints out address, but when I access my unordredMap with my keys I get the actual values 3, and 20

I'm not sure I understand, shouldn't i.second return 3 and 20

testinggnitset ser
  • 297
  • 1
  • 3
  • 17

0 Answers0