summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2021-10-08 14:39:40 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2021-10-08 14:39:40 +0100
commit5c4438a5bb7656b36cf9c5299cfbfa32f2834b7e (patch)
treedb9ff39ac1b587085e25d0babdd7bd0ff820d12a /src
parentde4454e5e19e1f62cb7746086ebcfd6dc35ad425 (diff)
downloadrspamd-5c4438a5bb7656b36cf9c5299cfbfa32f2834b7e.tar.gz
rspamd-5c4438a5bb7656b36cf9c5299cfbfa32f2834b7e.zip
[Minor] Add explicit move operators for mime_string
Diffstat (limited to 'src')
-rw-r--r--src/libmime/mime_string.hxx13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libmime/mime_string.hxx b/src/libmime/mime_string.hxx
index 94bdafb02..fbd03206a 100644
--- a/src/libmime/mime_string.hxx
+++ b/src/libmime/mime_string.hxx
@@ -283,6 +283,11 @@ public:
basic_mime_string(const view_type &st,
const Allocator& alloc = Allocator()) noexcept :
basic_mime_string(st.data(), st.size(), alloc) {}
+ /* Explicit move ctor */
+ basic_mime_string(basic_mime_string &&other) noexcept {
+ *this = std::move(other);
+ }
+
/**
* Creates a string with a filter function. It is calee responsibility to
@@ -310,6 +315,14 @@ public:
const Allocator& alloc = Allocator()) noexcept :
basic_mime_string(st.data(), st.size(), std::move(filt), alloc) {}
+ /* It seems some libc++ implementations still perform copy, this might fix them */
+ basic_mime_string& operator=(basic_mime_string &&other) {
+ storage = std::move(other.storage);
+ filter_func = std::move(other.filter_func);
+
+ return *this;
+ }
+
constexpr auto size() const noexcept -> std::size_t {
return storage.size();
}