Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
overall optimization of map usage
[simgrid.git] / src / xbt / xbt_replay.cpp
index 495e19a..74bc5a3 100644 (file)
@@ -34,9 +34,9 @@ class ReplayReader {
 public:
   explicit ReplayReader(const char* filename)
   {
-         XBT_VERB("Prepare to replay file '%s'", filename);
-         fs = new std::ifstream(filename, std::ifstream::in);
-          xbt_assert(fs->is_open(), "Cannot read replay file '%s'", filename);
+    XBT_VERB("Prepare to replay file '%s'", filename);
+    fs = new std::ifstream(filename, std::ifstream::in);
+    xbt_assert(fs->is_open(), "Cannot read replay file '%s'", filename);
   }
   ~ReplayReader()
   {
@@ -78,9 +78,9 @@ static ReplayAction* get_action(char* name)
       } else {
         // Else, I have to store it for the relevant colleague
         std::queue<ReplayAction*>* otherqueue = nullptr;
-        if (action_queues.find(evtname) != action_queues.end())
+        try {
           otherqueue = action_queues.at(evtname);
-        else { // Damn. Create the queue of that guy
+        } catch (std::out_of_range& unfound) { // Damn. Create the queue of that guy
           otherqueue = new std::queue<ReplayAction*>();
           action_queues.insert({evtname, otherqueue});
         }