Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
have a on_completion per activity type to save users some dynamic_cast-based filtering
[simgrid.git] / examples / cpp / io-degradation / s4u-io-degradation.cpp
index f2c3e1853c2cb236063e8648f61c166522b35fa5..9ab897a28511612dd761717f25dcdc0bf6dd26a8 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2017-2022. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2017-2023. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -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;
 }
 
 /**