improved SOO swap, fixed Darwin-clang build config

This commit is contained in:
Aleksandar Fabijanic
2013-03-31 16:28:53 -05:00
parent 6b871a8cab
commit 1f4afb9c6c
4 changed files with 37 additions and 16 deletions

View File

@@ -668,9 +668,17 @@ inline void Var::swap(Var& other)
else
{
Var tmp(*this);
if (_placeholder.isLocal()) destruct();
construct(other);
other = tmp;
try
{
if (_placeholder.isLocal()) destruct();
construct(other);
other = tmp;
}
catch (...)
{
construct(tmp);
throw;
}
}
#endif