layer_map taken by value, which means that the following code operates on a copy, and fails to do anything unless layer_map.empty() evaluates to true later.