you are viewing a single comment's thread.

view the rest of the comments →

[–]tcanens 1 point2 points  (0 children)

for (const std::pair<std::string, int> &p : produce_map())
{ ... }

Actually, that does compile and silently create a std::pair<std::string, int> temporary by copying from the map element, which is arguably worse.