Skip to content
Snippets Groups Projects
Commit c6247430 authored by Gemma Guest's avatar Gemma Guest
Browse files

Re #19773 Add missing operator= overload

Fixes cppcheck warning. The overload is required to avoid the
possibility of an incorrect raw pointer copy.
parent f02d6977
No related merge requests found
...@@ -112,6 +112,15 @@ public: ...@@ -112,6 +112,15 @@ public:
m_pPtr = static_cast<T *>(this); m_pPtr = static_cast<T *>(this);
} }
/// Overloaded = operator sets the pointer to the wrapped class
/// and copies over the contents
WrappedObject<T> &operator=(const WrappedObject<T> &rhs) {
if (this != &rhs) {
m_pPtr = static_cast<T *>(this);
*m_pPtr = rhs;
}
return *this;
}
/// Overloaded * operator returns the wrapped object pointer /// Overloaded * operator returns the wrapped object pointer
const T &operator*() const { return *m_pPtr; } const T &operator*() const { return *m_pPtr; }
/// Overloaded * operator returns the wrapped object pointer /// Overloaded * operator returns the wrapped object pointer
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment