From 7cec7c8aa276d330bf4efbf7aa27443dcc765a93 Mon Sep 17 00:00:00 2001 From: Vassil Vassilev Date: Mon, 5 Aug 2024 13:48:09 +0000 Subject: [PATCH] Return const ref instead of a copy. --- include/clad/Differentiator/DynamicGraph.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/clad/Differentiator/DynamicGraph.h b/include/clad/Differentiator/DynamicGraph.h index db1113116..f7b5f61b0 100644 --- a/include/clad/Differentiator/DynamicGraph.h +++ b/include/clad/Differentiator/DynamicGraph.h @@ -106,7 +106,7 @@ template class DynamicGraph { bool isProcessingNode() { return m_currentId != -1; } /// Get the nodes in the graph. - std::vector getNodes() { return m_nodes; } + const std::vector& getNodes() { return m_nodes; } /// Print the nodes and edges in the graph. void print() { @@ -140,4 +140,4 @@ template class DynamicGraph { }; } // end namespace clad -#endif // CLAD_DIFFERENTIATOR_DYNAMICGRAPH_H \ No newline at end of file +#endif // CLAD_DIFFERENTIATOR_DYNAMICGRAPH_H