mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
ZeekString: Implement move constructor
This commit is contained in:
parent
8fc5b7fcda
commit
0ecbd4435e
2 changed files with 9 additions and 0 deletions
|
@ -37,6 +37,12 @@ String::String(bool arg_final_NUL, byte_vec str, int arg_n) {
|
||||||
use_free_to_delete = false;
|
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(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); }
|
String::String(std::string_view str) : String() { Set(str); }
|
||||||
|
|
|
@ -47,6 +47,9 @@ public:
|
||||||
// Constructor that takes ownership of the vector passed in.
|
// Constructor that takes ownership of the vector passed in.
|
||||||
String(bool arg_final_NUL, byte_vec str, int arg_n);
|
String(bool arg_final_NUL, byte_vec str, int arg_n);
|
||||||
|
|
||||||
|
// Move constructor
|
||||||
|
String(String&& s) noexcept;
|
||||||
|
|
||||||
String();
|
String();
|
||||||
~String() { Reset(); }
|
~String() { Reset(); }
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue