I have some (C++14) code that looks like this:
map> junk;
for (int id : GenerateIds()) {
try {
set stuff =
You're misunderstanding how operator[] works on std::map.
It returns a reference to the mapped item. Therefore, your code is first inserting a default item in that position and then invoking operator= to set a new value.
To make this work the way you expect, you'll need to use std::map::insert (*):
junk.insert(std::make_pair(id, GetStuff()));
Caveat: insert will only add the value if id is not already mapped.