diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2022-01-17 22:20:05 +0100 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2022-01-18 11:12:30 +0100 |
commit | d62a9390fcdc0f9e4971e5fab2f667567237b252 (patch) | |
tree | cdbf6aef8b15b2ba5f02f7426ec2e5cd1f595e39 /src/libutil/serialise.hh | |
parent | 52ee7ec0028263f04e15c05256ca90fa62a0da66 (diff) |
Get rid of std::shared_ptr<std::string> and ref<std::string>
These were needed back in the pre-C++11 era because we didn't have
move semantics. But now we do.
Diffstat (limited to 'src/libutil/serialise.hh')
-rw-r--r-- | src/libutil/serialise.hh | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/libutil/serialise.hh b/src/libutil/serialise.hh index e80fb9ecf..fdd35aa00 100644 --- a/src/libutil/serialise.hh +++ b/src/libutil/serialise.hh @@ -154,12 +154,13 @@ private: /* A sink that writes data to a string. */ struct StringSink : Sink { - ref<std::string> s; - StringSink() : s(make_ref<std::string>()) { }; - explicit StringSink(const size_t reservedSize) : s(make_ref<std::string>()) { - s->reserve(reservedSize); + std::string s; + StringSink() { } + explicit StringSink(const size_t reservedSize) + { + s.reserve(reservedSize); }; - StringSink(ref<std::string> s) : s(s) { }; + StringSink(std::string && s) : s(std::move(s)) { }; void operator () (std::string_view data) override; }; |