Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Prefer using emplace or emplace_back.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Wed, 16 Dec 2020 10:50:58 +0000 (11:50 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Wed, 16 Dec 2020 20:49:00 +0000 (21:49 +0100)
src/instr/instr_interface.cpp
src/mc/inspect/LocationList.cpp
src/smpi/internals/smpi_global.cpp

index 0f353c7..0635cee 100644 (file)
@@ -82,8 +82,8 @@ void TRACE_category_with_color (const char *category, const char *color)
   //check if category is already created
   if (created_categories.find(category) != created_categories.end())
     return;
-  else
-    created_categories.insert(category);
+
+  created_categories.emplace(category);
 
   //define final_color
   std::string final_color;
@@ -148,7 +148,7 @@ void TRACE_declare_mark(const char *mark_type)
 
   XBT_DEBUG("MARK,declare %s", mark_type);
   simgrid::instr::Container::get_root()->type_->by_name_or_create<simgrid::instr::EventType>(mark_type);
-  declared_marks.insert(mark_type);
+  declared_marks.emplace(mark_type);
 }
 
 /** @ingroup TRACE_mark
index 212c25e..502ff3a 100644 (file)
@@ -88,7 +88,7 @@ LocationList location_list(const simgrid::mc::ObjectInformation& info, Dwarf_Att
     else
       range = {base_address + start, base_address + end};
 
-    locations.push_back({DwarfExpression(ops, ops + len), range});
+    locations.emplace_back(DwarfExpression(ops, ops + len), range);
   }
 
   return locations;
index a8798fd..3d96f24 100644 (file)
@@ -275,9 +275,7 @@ static void smpi_init_papi()
         }
         XBT_DEBUG("Successfully added PAPI event '%s' to the event set.", event_name);
 
-        counters2values.push_back(
-            // We cannot just pass *events_it, as this is of type const basic_string
-            std::make_pair(std::string(*events_it), 0LL));
+        counters2values.emplace_back(*events_it, 0LL);
       }
 
       std::string unit_name    = *(event_tokens.begin());