Skip to content

Commit

Permalink
Return const ref instead of a copy.
Browse files Browse the repository at this point in the history
  • Loading branch information
vgvassilev committed Aug 5, 2024
1 parent 7d1e26c commit 7cec7c8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/clad/Differentiator/DynamicGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ template <typename T> class DynamicGraph {
bool isProcessingNode() { return m_currentId != -1; }

/// Get the nodes in the graph.
std::vector<T> getNodes() { return m_nodes; }
const std::vector<T>& getNodes() { return m_nodes; }

/// Print the nodes and edges in the graph.
void print() {
Expand Down Expand Up @@ -140,4 +140,4 @@ template <typename T> class DynamicGraph {
};
} // end namespace clad

#endif // CLAD_DIFFERENTIATOR_DYNAMICGRAPH_H
#endif // CLAD_DIFFERENTIATOR_DYNAMICGRAPH_H

0 comments on commit 7cec7c8

Please sign in to comment.