#include <xbt/PropertyHolder.hpp>
#include <map>
+#include <memory>
namespace simgrid {
namespace xbt {
void PropertyHolder::set_property(const std::string& key, const std::string& value)
{
if (not properties_)
- properties_.reset(new std::unordered_map<std::string, std::string>);
+ properties_ = std::make_unique<std::unordered_map<std::string, std::string>>();
(*properties_)[key] = value;
}
const std::unordered_map<std::string, std::string>* PropertyHolder::get_properties()
{
if (not properties_)
- properties_.reset(new std::unordered_map<std::string, std::string>);
+ properties_ = std::make_unique<std::unordered_map<std::string, std::string>>();
return properties_.get();
}
template <class Assoc> void PropertyHolder::set_properties(const Assoc& properties)
{
if (not properties_)
- properties_.reset(new std::unordered_map<std::string, std::string>);
+ properties_ = std::make_unique<std::unordered_map<std::string, std::string>>();
std::unordered_map<std::string, std::string> props(properties.cbegin(), properties.cend());
#if __cplusplus >= 201703L
props.merge(properties_);