Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
void
value::
swap(value& other)
{
if(*get_storage() != *other.get_storage())
{
value temp1(
std::move(*this),
other.get_storage());
value temp2(
std::move(other),
this->get_storage());
other.~value();
::new(&other) value(pilfer(temp1));
this->~value();
::new(this) value(pilfer(temp2));
}
else
{
value tmp(pilfer(*this));
this->~value();
::new(this) value(pilfer(other));
other.~value();
::new(&other) value(pilfer(tmp));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.