Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use const references (sonar).
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 28 Apr 2022 13:53:51 +0000 (15:53 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 28 Apr 2022 13:53:51 +0000 (15:53 +0200)
src/instr/instr_paje_containers.cpp
src/kernel/routing/NetZoneImpl.cpp

index 8fcdfa0..647857d 100644 (file)
@@ -74,7 +74,7 @@ Container::~Container()
 {
   XBT_DEBUG("destroy container %s", get_cname());
   // Begin with destroying my own children
-  for (auto [_, child] : children_)
+  for (auto const& [_, child] : children_)
     delete child;
 
   // remove me from the all_containers_ data structure
index 1de62fd..0d511d7 100644 (file)
@@ -112,11 +112,11 @@ NetZoneImpl::~NetZoneImpl()
   /* Since hosts_ and links_ are a std::map, the hosts are destroyed in the lexicographic order, which ensures that the
    * output is reproducible.
    */
-  for (auto& [_, host] : hosts_) {
+  for (auto const& [_, host] : hosts_) {
     host->destroy();
   }
   hosts_.clear();
-  for (auto& [_, link] : links_) {
+  for (auto const& [_, link] : links_) {
     link->destroy();
   }
   links_.clear();