From: Yehuda Sadeh Date: Thu, 8 Nov 2018 20:43:21 +0000 (-0800) Subject: librados_test_stub: implement move operations X-Git-Tag: v14.1.0~965^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=e0dc5a86cb582c5b514842b21acea657c074aea3;p=ceph-ci.git librados_test_stub: implement move operations Need to match whatever librados implements. Signed-off-by: Yehuda Sadeh --- diff --git a/src/test/librados_test_stub/LibradosTestStub.cc b/src/test/librados_test_stub/LibradosTestStub.cc index 17221b24c30..4ad154bd1dc 100644 --- a/src/test/librados_test_stub/LibradosTestStub.cc +++ b/src/test/librados_test_stub/LibradosTestStub.cc @@ -367,6 +367,10 @@ IoCtx::IoCtx(const IoCtx& rhs) { } } +IoCtx::IoCtx(IoCtx&& rhs) noexcept : io_ctx_impl(std::exchange(rhs.io_ctx_impl, nullptr)) +{ +} + IoCtx& IoCtx::operator=(const IoCtx& rhs) { if (io_ctx_impl) { TestIoCtxImpl *ctx = reinterpret_cast(io_ctx_impl); @@ -381,6 +385,17 @@ IoCtx& IoCtx::operator=(const IoCtx& rhs) { return *this; } +librados::IoCtx& librados::IoCtx::operator=(IoCtx&& rhs) noexcept +{ + if (io_ctx_impl) { + TestIoCtxImpl *ctx = reinterpret_cast(io_ctx_impl); + ctx->put(); + } + + io_ctx_impl = std::exchange(rhs.io_ctx_impl, nullptr); + return *this; +} + int IoCtx::aio_flush() { TestIoCtxImpl *ctx = reinterpret_cast(io_ctx_impl); ctx->aio_flush();