X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/ea74f5d95928a521a588737e81f1de94eef25d19..af6d6b158ab3c99f190cb670b1918bbadaa9e250:/src/instr/instr_paje_containers.cpp diff --git a/src/instr/instr_paje_containers.cpp b/src/instr/instr_paje_containers.cpp index 3802ba9376..f53a60866c 100644 --- a/src/instr/instr_paje_containers.cpp +++ b/src/instr/instr_paje_containers.cpp @@ -10,8 +10,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_paje_containers, instr, "Paje tracing event system (containers)"); -namespace simgrid { -namespace instr { +namespace simgrid::instr { Container* Container::root_container_ = nullptr; /* the root container */ std::map> Container::all_containers_; /* all created containers indexed by name */ @@ -23,7 +22,7 @@ NetZoneContainer::NetZoneContainer(const std::string& name, unsigned int level, if (parent_) { std::string type_name = std::string("L") + std::to_string(level); type_ = parent_->type_->by_name_or_create(type_name); - parent_->children_.insert({get_name(), this}); + parent_->children_.try_emplace(get_name(), this); on_creation(*this); } else { type_ = new ContainerType("0"); @@ -57,13 +56,13 @@ Container::Container(const std::string& name, const std::string& type_name, Cont if (not type_name.empty()) { type_ = parent_->type_->by_name_or_create(type_name); - parent_->children_.insert({name_, this}); + parent_->children_.try_emplace(name_, this); on_creation(*this); } } //register all kinds by name - if (not all_containers_.emplace(name_, this).second) + if (not all_containers_.try_emplace(name_, this).second) throw TracingError(XBT_THROW_POINT, xbt::string_printf("container %s already present in all_containers_", get_cname())); @@ -74,8 +73,8 @@ Container::~Container() { XBT_DEBUG("destroy container %s", get_cname()); // Begin with destroying my own children - for (auto child : children_) - delete child.second; + for (auto const& [_, child] : children_) + delete child; // remove me from the all_containers_ data structure all_containers_.erase(name_); @@ -136,5 +135,4 @@ EntityValue::EntityValue(const std::string& name, const std::string& color, Type on_creation(*this); } -} // namespace instr -} // namespace simgrid +} // namespace simgrid::instr