I had a simple question. I surfed through the internet and came upon this solution for reverse iterating a map:
1 2 3 4
for (auto it = map.rbegin(); it != map.rend(); it++) {
it->first... // key
it->second... // value
}
My question is that if I changed it->second to it->second->x += 2 or something, will it modify the actual object in the map or will auto it = map.rbegin() make a copy of the object?
Note: This is assuming that the map's value is a pointer type; std::map<int, Object*> map;
I strongly believe that this will change the actual object, I just want to confirm.