Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] Replace "std::function" by a template parameter.
[simgrid.git] / src / xbt / config.cpp
index b4d7e54..f70eec1 100644 (file)
@@ -275,7 +275,7 @@ public:
     TypedConfigurationElement<T>* variable = new TypedConfigurationElement<T>(name, std::forward<A>(a)...);
     XBT_DEBUG("Register cfg elm %s (%s) of type %s @%p in set %p)", name.c_str(), variable->get_description().c_str(),
               variable->get_type_name(), variable, this);
-    options.emplace(name, std::unique_ptr<ConfigurationElement>(variable));
+    options[name].reset(variable);
     variable->update();
     return variable;
   }
@@ -307,7 +307,7 @@ inline ConfigurationElement* Config::get_dict_element(const std::string& name)
         XBT_INFO("Option %s has been renamed to %s. Consider switching.", name.c_str(), res->get_key().c_str());
       return res;
     } else {
-      THROWF(not_found_error, 0, "Bad config key: %s", name.c_str());
+      throw std::out_of_range("Bad config key: " + name);
     }
   }
 }