Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Return const reference to vector.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 12 Apr 2021 09:49:33 +0000 (11:49 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 12 Apr 2021 09:49:33 +0000 (11:49 +0200)
include/simgrid/kernel/routing/NetZoneImpl.hpp
src/kernel/routing/NetZoneImpl.cpp
src/s4u/s4u_Netzone.cpp

index 6246bf4..0dbbc4f 100644 (file)
@@ -116,7 +116,7 @@ public:
   NetZoneImpl* get_parent() const { return parent_; }
   /** @brief Returns the list of direct children (no grand-children). This returns the internal data, no copy.
    * Don't mess with it.*/
-  std::vector<NetZoneImpl*>* get_children() { return &children_; }
+  const std::vector<NetZoneImpl*>& get_children() { return children_; }
   /** @brief Get current netzone hierarchy */
   RoutingMode get_hierarchy() const { return hierarchy_; }
 
index 4df1cef..a47f4b4 100644 (file)
@@ -470,7 +470,7 @@ void NetZoneImpl::seal()
   for (auto* host : get_all_hosts()) {
     host->seal();
   }
-  for (auto* sub_net : *get_children()) {
+  for (auto* sub_net : get_children()) {
     sub_net->seal();
   }
   sealed_ = true;
index 4f97b64..cfa9da0 100644 (file)
@@ -42,7 +42,7 @@ void NetZone::set_property(const std::string& key, const std::string& value)
 std::vector<NetZone*> NetZone::get_children() const
 {
   std::vector<NetZone*> res;
-  for (auto child : *(pimpl_->get_children()))
+  for (auto child : pimpl_->get_children())
     res.push_back(child->get_iface());
   return res;
 }