Skip to content

Commit 3153252

Browse files
authored
fix(autoware_compare_map_segmentation): fix cppcheck constVariableReference (#9196)
Signed-off-by: Ryuta Kambe <ryuta.kambe@tier4.jp>
1 parent f13503a commit 3153252

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

perception/autoware_compare_map_segmentation/src/voxel_grid_map_loader/voxel_grid_map_loader.hpp

+7-4
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,13 @@ class VoxelGridDynamicMapLoader : public VoxelGridMapLoader
207207
}
208208
inline std::vector<std::string> getCurrentMapIDs()
209209
{
210-
std::vector<std::string> current_map_ids{};
211-
std::lock_guard<std::mutex> lock(dynamic_map_loader_mutex_);
212-
for (auto & kv : current_voxel_grid_dict_) {
213-
current_map_ids.push_back(kv.first);
210+
std::vector<std::string> current_map_ids;
211+
{
212+
std::lock_guard<std::mutex> lock(dynamic_map_loader_mutex_);
213+
current_map_ids.reserve(current_voxel_grid_dict_.size());
214+
for (const auto & kv : current_voxel_grid_dict_) {
215+
current_map_ids.push_back(kv.first);
216+
}
214217
}
215218
return current_map_ids;
216219
}

0 commit comments

Comments
 (0)