mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-16 18:56:52 +02:00
factor out Var destruction
This commit is contained in:
@@ -572,6 +572,11 @@ private:
|
||||
return _pHolder;
|
||||
}
|
||||
|
||||
void destruct()
|
||||
{
|
||||
if(!isEmpty()) delete content();
|
||||
}
|
||||
|
||||
VarHolder* _pHolder;
|
||||
|
||||
#else
|
||||
@@ -619,6 +624,17 @@ private:
|
||||
_placeholder.erase();
|
||||
}
|
||||
|
||||
void destruct()
|
||||
{
|
||||
if(!isEmpty())
|
||||
{
|
||||
if(_placeholder.isLocal())
|
||||
content()->~VarHolder();
|
||||
else
|
||||
delete content();
|
||||
}
|
||||
}
|
||||
|
||||
Placeholder<VarHolder> _placeholder;
|
||||
|
||||
#endif // POCO_NO_SOO
|
||||
@@ -652,7 +668,7 @@ inline void Var::swap(Var& other)
|
||||
else
|
||||
{
|
||||
Var tmp(*this);
|
||||
if (_placeholder.isLocal()) this->~Var();
|
||||
if (_placeholder.isLocal()) destruct();
|
||||
construct(other);
|
||||
other = tmp;
|
||||
}
|
||||
|
Reference in New Issue
Block a user