This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 049032b4b3 Refactor Slice move/copy ctor && assignment to default
(#24169)
049032b4b3 is described below
commit 049032b4b31ee085c79d31e6bd0a8bc424f127f1
Author: Jack Drogon <[email protected]>
AuthorDate: Thu Sep 14 14:18:10 2023 +0800
Refactor Slice move/copy ctor && assignment to default (#24169)
Signed-off-by: Jack Drogon <[email protected]>
Co-authored-by: yiguolei <[email protected]>
---
be/src/util/slice.h | 29 +++++------------------------
1 file changed, 5 insertions(+), 24 deletions(-)
diff --git a/be/src/util/slice.h b/be/src/util/slice.h
index a389b42403..0c5c16d714 100644
--- a/be/src/util/slice.h
+++ b/be/src/util/slice.h
@@ -80,30 +80,11 @@ public:
data(const_cast<char*>(s)),
size(strlen(s)) {}
- Slice(const Slice& src) : data(src.data), size(src.size) {}
-
- Slice& operator=(const Slice& src) {
- if (this != &src) {
- data = src.data;
- size = src.size;
- }
- return *this;
- }
-
- Slice(Slice&& src) : data(src.data), size(src.size) {
- src.data = nullptr;
- src.size = 0;
- }
-
- Slice& operator=(Slice&& src) {
- if (this != &src) {
- data = src.data;
- size = src.size;
- src.data = nullptr;
- src.size = 0;
- }
- return *this;
- }
+ /// default copy/move constructor and assignment
+ Slice(const Slice&) = default;
+ Slice& operator=(const Slice&) = default;
+ Slice(Slice&&) noexcept = default;
+ Slice& operator=(Slice&&) noexcept = default;
/// @return A pointer to the beginning of the referenced data.
const char* get_data() const { return data; }
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]