File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed
Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -532,6 +532,14 @@ class CEPH_RBD_API Image
532532 Image ();
533533 ~Image ();
534534
535+ // non-copyable
536+ Image (const Image& rhs) = delete ;
537+ Image& operator =(const Image& rhs) = delete ;
538+
539+ // moveable
540+ Image (Image&& rhs) noexcept ;
541+ Image& operator =(Image&& rhs) noexcept ;
542+
535543 int close ();
536544 int aio_close (RBD::AioCompletion *c);
537545
@@ -854,9 +862,6 @@ class CEPH_RBD_API Image
854862private:
855863 friend class RBD ;
856864
857- Image (const Image& rhs);
858- const Image& operator =(const Image& rhs);
859-
860865 image_ctx_t ctx;
861866};
862867
Original file line number Diff line number Diff line change 5151#include " librbd/io/ReadResult.h"
5252#include < algorithm>
5353#include < string>
54+ #include < utility>
5455#include < vector>
5556
5657#ifdef WITH_LTTNG
@@ -1609,6 +1610,17 @@ namespace librbd {
16091610 close ();
16101611 }
16111612
1613+ Image::Image (Image&& rhs) noexcept : ctx{std::exchange (rhs.ctx , nullptr )}
1614+ {
1615+ }
1616+
1617+ Image& Image::operator =(Image&& rhs) noexcept
1618+ {
1619+ Image tmp (std::move (rhs));
1620+ std::swap (ctx, tmp.ctx );
1621+ return *this ;
1622+ }
1623+
16121624 int Image::close ()
16131625 {
16141626 int r = 0 ;
You can’t perform that action at this time.
0 commit comments