From ff1c33bc8112f651c77544854051de234eb06d86 Mon Sep 17 00:00:00 2001 From: Wiebe Cazemier Date: Sat, 27 Mar 2021 10:31:55 +0100 Subject: [PATCH] Prevent unnecessary copy --- subscriptionstore.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subscriptionstore.cpp b/subscriptionstore.cpp index 1eb2697..611ecec 100644 --- a/subscriptionstore.cpp +++ b/subscriptionstore.cpp @@ -241,7 +241,7 @@ void SubscriptionStore::publishRecursively(std::vector::const_itera if (this_node->children.empty() && !this_node->childrenPlus && !this_node->childrenPound) return; - std::string cur_subtop = *cur_subtopic_it; + const std::string &cur_subtop = *cur_subtopic_it; const auto next_subtopic = ++cur_subtopic_it; @@ -250,7 +250,7 @@ void SubscriptionStore::publishRecursively(std::vector::const_itera publishNonRecursively(packet, this_node->childrenPound->getSubscribers()); } - auto sub_node = this_node->children.find(cur_subtop); + const auto &sub_node = this_node->children.find(cur_subtop); if (sub_node != this_node->children.end()) { publishRecursively(next_subtopic, end, sub_node->second, packet); -- libgit2 0.21.4