diff --git a/include/aidge/graph/GraphView.hpp b/include/aidge/graph/GraphView.hpp index 2e6323d707da51211f0150ea1899c028e2d241e6..f11136adaaa3d23fa9d3dc5749dd5d6771cbc42c 100644 --- a/include/aidge/graph/GraphView.hpp +++ b/include/aidge/graph/GraphView.hpp @@ -208,7 +208,7 @@ public: * @brief Get the Nodes pointed to by the GraphView object. * @return std::set<NodePtr> */ - inline std::set<NodePtr> getNodes() const { return mNodes; } + inline const std::set<NodePtr>& getNodes() const { return mNodes; } /** * @brief Get the operator with the corresponding name if it is in the diff --git a/src/graph/Connector.cpp b/src/graph/Connector.cpp index f189b92b24cc5529ae8fb6d8c9faac97e296a92c..cd2ceff8b58076a5054269e4676120b94c8b5beb 100644 --- a/src/graph/Connector.cpp +++ b/src/graph/Connector.cpp @@ -39,7 +39,7 @@ std::shared_ptr<Aidge::GraphView> Aidge::generateGraph(std::vector<Connector> ct graph->add(nodesToAdd.back()); // only add, connection already done // between nodes std::vector<std::shared_ptr<Node>> parents = nodesToAdd.back()->getParents(); - std::set<std::shared_ptr<Node>> alreadyAdded = graph->getNodes(); + const std::set<std::shared_ptr<Node>>& alreadyAdded = graph->getNodes(); for (std::shared_ptr<Node> parent : parents) { if (alreadyAdded.find(parent) == alreadyAdded.end()) { buffer.push_back(parent);