IVParamObj: Explicitly supply copy and move constructor/assingnment operators

Since the copy constructor is provided, we should explicitly specify the
others to make behavior explicit (and prevent the copy constructor from
being considered over the move constructor in certain scenarios).
This commit is contained in:
Lioncash 2019-09-30 02:46:31 -04:00
parent 541adb02d2
commit 026de44611
1 changed files with 8 additions and 2 deletions

View File

@ -24,9 +24,15 @@ class CVParamTransfer {
std::shared_ptr<IVParamObj> m_ref; std::shared_ptr<IVParamObj> m_ref;
public: public:
CVParamTransfer() = default; CVParamTransfer() noexcept = default;
CVParamTransfer(IVParamObj* obj) : m_ref(obj) {} CVParamTransfer(IVParamObj* obj) : m_ref(obj) {}
CVParamTransfer(const CVParamTransfer& other) : m_ref(other.m_ref) {}
CVParamTransfer(const CVParamTransfer& other) noexcept = default;
CVParamTransfer& operator=(const CVParamTransfer&) noexcept = default;
CVParamTransfer(CVParamTransfer&&) noexcept = default;
CVParamTransfer& operator=(CVParamTransfer&&) noexcept = default;
IVParamObj* GetObj() const { return m_ref.get(); } IVParamObj* GetObj() const { return m_ref.get(); }
CVParamTransfer ShareTransferRef() const { return CVParamTransfer(*this); } CVParamTransfer ShareTransferRef() const { return CVParamTransfer(*this); }