diff --git a/src/Storage.cpp b/src/Storage.cpp index ba52eac3ae..47a467eecd 100644 --- a/src/Storage.cpp +++ b/src/Storage.cpp @@ -140,7 +140,7 @@ void Storage::SavePersistent(std::ostream& os) const { } case NT_STRING_ARRAY: { bool first = true; - for (auto elem : v.GetStringArray()) { + for (auto& elem : v.GetStringArray()) { if (!first) { os << ','; first = false; diff --git a/src/Value.h b/src/Value.h index d04c0978b2..b8b2049d9e 100644 --- a/src/Value.h +++ b/src/Value.h @@ -20,6 +20,9 @@ namespace ntimpl { class Storage; class Value; +/* + * C++ wrapper class around NT_String. + */ class StringValue : private NT_String { friend class Value; public: @@ -27,8 +30,14 @@ class StringValue : private NT_String { ~StringValue() { NT_DisposeString(this); } operator llvm::StringRef() const { return llvm::StringRef(str, len); } + + StringValue(const StringValue&) = delete; + StringValue& operator=(const StringValue&) = delete; }; +/* + * C++ wrapper class around NT_Value. + */ class Value : private NT_Value { friend class Storage; public: