mirror of
https://github.com/ceph/ceph
synced 2025-04-01 14:51:13 +00:00
librados: add move operations to IoCtx
Signed-off-by: Casey Bodley <cbodley@redhat.com>
This commit is contained in:
parent
238f0ef4a4
commit
cfd66c5f89
src
@ -710,6 +710,8 @@ namespace librados
|
||||
static void from_rados_ioctx_t(rados_ioctx_t p, IoCtx &pool);
|
||||
IoCtx(const IoCtx& rhs);
|
||||
IoCtx& operator=(const IoCtx& rhs);
|
||||
IoCtx(IoCtx&& rhs) noexcept;
|
||||
IoCtx& operator=(IoCtx&& rhs) noexcept;
|
||||
|
||||
~IoCtx();
|
||||
|
||||
|
@ -1051,6 +1051,19 @@ librados::IoCtx& librados::IoCtx::operator=(const IoCtx& rhs)
|
||||
return *this;
|
||||
}
|
||||
|
||||
librados::IoCtx::IoCtx(IoCtx&& rhs) noexcept
|
||||
: io_ctx_impl(std::exchange(rhs.io_ctx_impl, nullptr))
|
||||
{
|
||||
}
|
||||
|
||||
librados::IoCtx& librados::IoCtx::operator=(IoCtx&& rhs) noexcept
|
||||
{
|
||||
if (io_ctx_impl)
|
||||
io_ctx_impl->put();
|
||||
io_ctx_impl = std::exchange(rhs.io_ctx_impl, nullptr);
|
||||
return *this;
|
||||
}
|
||||
|
||||
librados::IoCtx::~IoCtx()
|
||||
{
|
||||
close();
|
||||
|
Loading…
Reference in New Issue
Block a user