ZeekString: Implement move constructor

This commit is contained in:
Arne Welzel 2024-11-04 14:41:19 +01:00
parent 8fc5b7fcda
commit 0ecbd4435e
2 changed files with 9 additions and 0 deletions

View file

@ -37,6 +37,12 @@ String::String(bool arg_final_NUL, byte_vec str, int arg_n) {
use_free_to_delete = false;
}
String::String(String&& other) noexcept
: b(other.b), n(other.n), final_NUL(other.final_NUL), use_free_to_delete(other.use_free_to_delete) {
other.b = nullptr;
other.Reset();
}
String::String(const u_char* str, int arg_n, bool add_NUL) : String() { Set(str, arg_n, add_NUL); }
String::String(std::string_view str) : String() { Set(str); }

View file

@ -47,6 +47,9 @@ public:
// Constructor that takes ownership of the vector passed in.
String(bool arg_final_NUL, byte_vec str, int arg_n);
// Move constructor
String(String&& s) noexcept;
String();
~String() { Reset(); }