copy assignment operator

This commit is contained in:
Ari Lazier 2016-08-04 11:11:46 -07:00
parent f86975f78e
commit 140599968f
1 changed files with 11 additions and 0 deletions

View File

@ -90,6 +90,12 @@ class Protected<JSValueRef> {
return JSValueIsStrictEqual(a.m_context, a.m_value, b.m_value);
}
};
Protected<JSValueRef>& operator=(Protected<JSValueRef> other) {
std::swap(m_context, other.m_context);
std::swap(m_value, other.m_value);
return *this;
}
};
template<>
@ -104,6 +110,11 @@ class Protected<JSObjectRef> : public Protected<JSValueRef> {
JSValueRef value = static_cast<JSValueRef>(*this);
return (JSObjectRef)value;
}
Protected<JSObjectRef>& operator=(Protected<JSObjectRef> other) {
std::swap(*this, other);
return *this;
}
};
} // js