From: Arnaud Giersch Date: Mon, 12 Apr 2021 09:49:33 +0000 (+0200) Subject: Return const reference to vector. X-Git-Tag: v3.28~455^2~82 X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/5315648fa5050a4077c6f97544abce0d0751e707 Return const reference to vector. --- diff --git a/include/simgrid/kernel/routing/NetZoneImpl.hpp b/include/simgrid/kernel/routing/NetZoneImpl.hpp index 6246bf4216..0dbbc4fdbc 100644 --- a/include/simgrid/kernel/routing/NetZoneImpl.hpp +++ b/include/simgrid/kernel/routing/NetZoneImpl.hpp @@ -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* get_children() { return &children_; } + const std::vector& get_children() { return children_; } /** @brief Get current netzone hierarchy */ RoutingMode get_hierarchy() const { return hierarchy_; } diff --git a/src/kernel/routing/NetZoneImpl.cpp b/src/kernel/routing/NetZoneImpl.cpp index 4df1cefb6a..a47f4b43f5 100644 --- a/src/kernel/routing/NetZoneImpl.cpp +++ b/src/kernel/routing/NetZoneImpl.cpp @@ -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; diff --git a/src/s4u/s4u_Netzone.cpp b/src/s4u/s4u_Netzone.cpp index 4f97b64206..cfa9da0475 100644 --- a/src/s4u/s4u_Netzone.cpp +++ b/src/s4u/s4u_Netzone.cpp @@ -42,7 +42,7 @@ void NetZone::set_property(const std::string& key, const std::string& value) std::vector NetZone::get_children() const { std::vector res; - for (auto child : *(pimpl_->get_children())) + for (auto child : pimpl_->get_children()) res.push_back(child->get_iface()); return res; }