mirror of https://github.com/AxioDL/amuse.git
Move semantics for IntrusiveAudioGroupData
This commit is contained in:
parent
b2fa66b738
commit
a893ee61bb
|
@ -30,9 +30,16 @@ public:
|
|||
*/
|
||||
class IntrusiveAudioGroupData : public AudioGroupData
|
||||
{
|
||||
bool m_owns = true;
|
||||
public:
|
||||
using AudioGroupData::AudioGroupData;
|
||||
~IntrusiveAudioGroupData();
|
||||
|
||||
IntrusiveAudioGroupData(const IntrusiveAudioGroupData&)=delete;
|
||||
IntrusiveAudioGroupData& operator=(const IntrusiveAudioGroupData&)=delete;
|
||||
|
||||
IntrusiveAudioGroupData(IntrusiveAudioGroupData&& other);
|
||||
IntrusiveAudioGroupData& operator=(IntrusiveAudioGroupData&& other);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -5,10 +5,33 @@ namespace amuse
|
|||
|
||||
IntrusiveAudioGroupData::~IntrusiveAudioGroupData()
|
||||
{
|
||||
delete m_pool;
|
||||
delete m_proj;
|
||||
delete m_sdir;
|
||||
delete m_samp;
|
||||
if (m_owns)
|
||||
{
|
||||
delete m_pool;
|
||||
delete m_proj;
|
||||
delete m_sdir;
|
||||
delete m_samp;
|
||||
}
|
||||
}
|
||||
|
||||
IntrusiveAudioGroupData::IntrusiveAudioGroupData(IntrusiveAudioGroupData&& other)
|
||||
: AudioGroupData(other.m_proj, other.m_pool, other.m_sdir, other.m_samp)
|
||||
{
|
||||
m_owns = other.m_owns;
|
||||
other.m_owns = false;
|
||||
}
|
||||
|
||||
IntrusiveAudioGroupData& IntrusiveAudioGroupData::operator=(IntrusiveAudioGroupData&& other)
|
||||
{
|
||||
m_owns = other.m_owns;
|
||||
other.m_owns = false;
|
||||
|
||||
m_proj = other.m_proj;
|
||||
m_pool = other.m_pool;
|
||||
m_sdir = other.m_sdir;
|
||||
m_samp = other.m_samp;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue