From 413264eaae51b657fd4349c291d1419727231085 Mon Sep 17 00:00:00 2001 From: Matt Pharr Date: Fri, 4 May 2012 13:42:43 -0700 Subject: [PATCH] Make return values const &s to save copying. --- type.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/type.h b/type.h index 8c3e8de2..0d155ef2 100644 --- a/type.h +++ b/type.h @@ -685,12 +685,12 @@ public: int GetElementNumber(const std::string &name) const; /** Returns the name of the i'th element of the structure. */ - const std::string GetElementName(int i) const { return elementNames[i]; } + const std::string &GetElementName(int i) const { return elementNames[i]; } /** Returns the total number of elements in the structure. */ int GetElementCount() const { return int(elementTypes.size()); } - SourcePos GetElementPosition(int i) const { return elementPositions[i]; } + const SourcePos &GetElementPosition(int i) const { return elementPositions[i]; } /** Returns the name of the structure type. (e.g. struct Foo -> "Foo".) */ const std::string &GetStructName() const { return name; }