]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Add explicit move operators for mime_string
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 8 Oct 2021 13:39:40 +0000 (14:39 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 8 Oct 2021 13:39:40 +0000 (14:39 +0100)
src/libmime/mime_string.hxx

index 94bdafb02236c5ee859979b318f671ba99485bd1..fbd03206a8d9b047d1f56d17bc0ce1fd3ee5ff24 100644 (file)
@@ -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();
        }