From 5315648fa5050a4077c6f97544abce0d0751e707 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Mon, 12 Apr 2021 11:49:33 +0200 Subject: [PATCH] Return const reference to vector. --- include/simgrid/kernel/routing/NetZoneImpl.hpp | 2 +- src/kernel/routing/NetZoneImpl.cpp | 2 +- src/s4u/s4u_Netzone.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) 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; } -- 2.20.1