Skip to content

Commit

Permalink
Merge pull request #76574 from akrieger/no_duping_allowed
Browse files Browse the repository at this point in the history
Don't unnecessarily copy items in a tight loop in get_uncraft_components
  • Loading branch information
Maleclypse authored Sep 21, 2024
2 parents e66affb + 7c286c7 commit 6805e26
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14908,8 +14908,7 @@ std::vector<item_comp> item::get_uncraft_components() const
if( component.has_flag( flag_UNRECOVERABLE ) ) {
continue;
}
// NOLINTNEXTLINE(clang-analyzer-cplusplus.NewDeleteLeaks)
auto iter = std::find_if( ret.begin(), ret.end(), [component]( item_comp & obj ) {
auto iter = std::find_if( ret.begin(), ret.end(), [&component]( item_comp & obj ) {
return obj.type == component.typeId();
} );

Expand Down

0 comments on commit 6805e26

Please sign in to comment.