Skip to content

Commit edd6db5

Browse files
authored
Merge pull request openvanilla#838 from ChiahongHong/ref_count
Avoid shared_ptr copies in Span::nodeOf
2 parents 6316592 + 31307ab commit edd6db5

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

Source/Engine/gramambular2/reading_grid.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ void ReadingGrid::Span::removeNodesOfOrLongerThan(size_t length) {
577577
}
578578
}
579579

580-
ReadingGrid::NodePtr ReadingGrid::Span::nodeOf(size_t length) const {
580+
const ReadingGrid::NodePtr& ReadingGrid::Span::nodeOf(size_t length) const {
581581
assert(length > 0 && length <= kMaximumSpanLength);
582582
return nodes_[length - 1];
583583
}

Source/Engine/gramambular2/reading_grid.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ class ReadingGrid {
216216
void clear();
217217
void add(const NodePtr& node);
218218
void removeNodesOfOrLongerThan(size_t length);
219-
[[nodiscard]] NodePtr nodeOf(size_t length) const;
219+
[[nodiscard]] const NodePtr& nodeOf(size_t length) const;
220220
[[nodiscard]] size_t maxLength() const { return maxLength_; }
221221

222222
protected:

0 commit comments

Comments
 (0)