Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Search in map once only.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 6 May 2022 08:17:57 +0000 (10:17 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 6 May 2022 08:17:57 +0000 (10:17 +0200)
examples/cpp/io-degradation/s4u-io-degradation.cpp

index f2c3e18..41a5ed3 100644 (file)
@@ -88,11 +88,9 @@ static double ssd_dynamic_sharing(const sg4::Disk* /*disk*/, const std::string&
                                                                             {15, 239.}}}};
 
   const auto& data = SSD_SPEED.at(op);
+  const auto value = data.find(n);
   /* no special bandwidth for this disk sharing N flows, just returns maximal capacity */
-  if (data.find(n) != data.end())
-    capacity = data.at(n);
-
-  return capacity;
+  return value == data.end() ? capacity : value->second;
 }
 
 /**