Skip to content

Commit

Permalink
Using find instead of contains
Browse files Browse the repository at this point in the history
  • Loading branch information
LinZhihao-723 committed Oct 14, 2024
1 parent 45bb0ec commit 1386020
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions components/core/src/clp/ffi/KeyValuePairLogEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -511,10 +511,9 @@ auto check_key_uniqueness_among_sibling_nodes(
// ID safely without a repeated check.
auto const parent_node_id{node.get_parent_id_unsafe()};
auto const key_name{node.get_key_name()};
if (parent_node_id_to_key_names.contains(parent_node_id)) {
auto const [it, new_key_inserted]{
parent_node_id_to_key_names.at(parent_node_id).emplace(key_name)
};
auto const parent_node_id_to_key_names_it{parent_node_id_to_key_names.find(parent_node_id)};
if (parent_node_id_to_key_names_it != parent_node_id_to_key_names.end()) {
auto const [it, new_key_inserted]{parent_node_id_to_key_names_it->second.emplace(key_name)};
if (false == new_key_inserted) {
// The key is duplicated under the same parent
return false;
Expand Down

0 comments on commit 1386020

Please sign in to comment.