2

Give the following C++ code.

std::map<std::pair<int, int>, int> map;
int test = 0;
map[std::make_pair(test, 2)] = ++test;

The contents of map becomes to (1,2) -> 1. Why not (0, 2) -> 1? Can anyone explain the order of execution in this scenario?

bolov
  • 65,999
  • 14
  • 127
  • 202
8.8.8.8
  • 606
  • 7
  • 9

0 Answers0