Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- value&
- value::
- operator=(value const& other)
- {
- struct undo
- {
- union
- {
- value v;
- };
- value* pv;
- bool commit = false;
- explicit
- undo(value* pv_)
- : pv(pv_)
- {
- relocate(&v, *pv);
- }
- ~undo()
- {
- if(commit)
- v.~value();
- else
- relocate(pv, v);
- }
- };
- if(this != &other)
- {
- undo u(this);
- copy(other,
- u.v.get_storage());
- u.commit = true;
- }
- return *this;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement