Commit ff1c33bc8112f651c77544854051de234eb06d86

Authored by Wiebe Cazemier
1 parent 36e54790

Prevent unnecessary copy

Showing 1 changed file with 2 additions and 2 deletions
subscriptionstore.cpp
... ... @@ -241,7 +241,7 @@ void SubscriptionStore::publishRecursively(std::vector<std::string>::const_itera
241 241 if (this_node->children.empty() && !this_node->childrenPlus && !this_node->childrenPound)
242 242 return;
243 243  
244   - std::string cur_subtop = *cur_subtopic_it;
  244 + const std::string &cur_subtop = *cur_subtopic_it;
245 245  
246 246 const auto next_subtopic = ++cur_subtopic_it;
247 247  
... ... @@ -250,7 +250,7 @@ void SubscriptionStore::publishRecursively(std::vector<std::string>::const_itera
250 250 publishNonRecursively(packet, this_node->childrenPound->getSubscribers());
251 251 }
252 252  
253   - auto sub_node = this_node->children.find(cur_subtop);
  253 + const auto &sub_node = this_node->children.find(cur_subtop);
254 254 if (sub_node != this_node->children.end())
255 255 {
256 256 publishRecursively(next_subtopic, end, sub_node->second, packet);
... ...