Skip to content

Commit 3882c5c

Browse files
committed
xrCore/xr_resource.h: move semantic support
1 parent 61a6f07 commit 3882c5c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/xrCore/xr_resource.h

+15
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ class resptr_base
8080
T* prhs = rhs._get();
8181
_set(prhs);
8282
}
83+
ICF void _set(resptr_base<T>&& rhs)
84+
{
85+
p_ = rhs.p_;
86+
rhs.p_ = nullptr;
87+
}
8388
ICF T* _get() const { return p_; }
8489
void _clear() { p_ = 0; }
8590
};
@@ -106,13 +111,23 @@ class resptr_core : public C
106111
C::p_ = rhs.p_;
107112
C::_inc();
108113
}
114+
resptr_core(self&& rhs) noexcept
115+
{
116+
C::p_ = rhs.p_;
117+
rhs.p_ = nullptr;
118+
}
109119
~resptr_core() { C::_dec(); }
110120
// assignment
111121
self& operator=(const self& rhs)
112122
{
113123
this->_set(rhs);
114124
return (self&)*this;
115125
}
126+
self& operator=(self&& rhs) noexcept
127+
{
128+
this->_set(std::move(rhs));
129+
return (self&)*this;
130+
}
116131

117132
// accessors
118133
T& operator*() const { return *C::p_; }

0 commit comments

Comments
 (0)