Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
overall optimization of map usage
[simgrid.git] / src / kernel / routing / NetZoneImpl.cpp
index 2b4a84d..1486801 100644 (file)
@@ -260,16 +260,20 @@ bool NetZoneImpl::getBypassRoute(routing::NetPoint* src, routing::NetPoint* dst,
     for (int i = 0; i < max; i++) {
       if (i <= max_index_src && max <= max_index_dst) {
         key = {path_src.at(i)->netpoint_, path_dst.at(max)->netpoint_};
-        if (bypassRoutes_.find(key) != bypassRoutes_.end()) {
+        try {
           bypassedRoute = bypassRoutes_.at(key);
           break;
+        } catch (std::out_of_range& unfound) {
+          // Do nothing
         }
       }
       if (max <= max_index_src && i <= max_index_dst) {
         key = {path_src.at(max)->netpoint_, path_dst.at(i)->netpoint_};
-        if (bypassRoutes_.find(key) != bypassRoutes_.end()) {
+        try {
           bypassedRoute = bypassRoutes_.at(key);
           break;
+        } catch (std::out_of_range& unfound) {
+          // Do nothing
         }
       }
     }
@@ -279,9 +283,11 @@ bool NetZoneImpl::getBypassRoute(routing::NetPoint* src, routing::NetPoint* dst,
 
     if (max <= max_index_src && max <= max_index_dst) {
       key = {path_src.at(max)->netpoint_, path_dst.at(max)->netpoint_};
-      if (bypassRoutes_.find(key) != bypassRoutes_.end()) {
+      try {
         bypassedRoute = bypassRoutes_.at(key);
         break;
+      } catch (std::out_of_range& unfound) {
+        // Do nothing
       }
     }
   }