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
  • 72,283
  • 15
  • 145
  • 224
8.8.8.8
  • 678
  • 7
  • 11

0 Answers0