From 70817eb5a68d39802a2d93337acb2147c87555de Mon Sep 17 00:00:00 2001 From: Andrey Mironov Date: Thu, 26 Feb 2015 17:51:28 +0300 Subject: [PATCH] dbms: move semantics for PODArray --- dbms/include/DB/Common/PODArray.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dbms/include/DB/Common/PODArray.h b/dbms/include/DB/Common/PODArray.h index 43b93568a97..0b4e0550a30 100644 --- a/dbms/include/DB/Common/PODArray.h +++ b/dbms/include/DB/Common/PODArray.h @@ -177,6 +177,17 @@ public: PODArray(const_iterator from_begin, const_iterator from_end) : use_libc_realloc(false) { alloc(from_end - from_begin); insert(from_begin, from_end); } ~PODArray() { dealloc(); } + PODArray(PODArray && other) { *this = std::move(other); } + PODArray & operator=(PODArray && other) + { + std::swap(c_start, other.c_start); + std::swap(c_end, other.c_end); + std::swap(c_end_of_storage, other.c_end_of_storage); + std::swap(use_libc_realloc, other.use_libc_realloc); + + return *this; + } + size_t size() const { return t_end() - t_start(); } bool empty() const { return t_end() == t_start(); }