1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-23 17:30:17 +01:00

Prohibit copy of TrackList, no longer needed; allow swap and move

This commit is contained in:
Paul Licameli
2018-01-10 23:58:36 -05:00
parent c0f2782695
commit e0d826a542
2 changed files with 6 additions and 35 deletions

View File

@@ -792,15 +792,6 @@ std::shared_ptr<TrackList> TrackList::Create()
return result;
}
TrackList& TrackList::operator= (const TrackList &that)
{
if (this != &that) {
this->Clear();
DoAssign(that);
}
return *this;
}
TrackList &TrackList::operator= (TrackList &&that)
{
if (this != &that) {
@@ -810,23 +801,6 @@ TrackList &TrackList::operator= (TrackList &&that)
return *this;
}
void TrackList::DoAssign(const TrackList &that)
{
auto copyLOT = [](
ListOfTracks &dst, const std::weak_ptr< TrackList > &self,
const ListOfTracks &src )
{
for (const auto &ptr : src)
dst.push_back(
ListOfTracks::value_type{ ptr->Duplicate().release() } );
for (auto it = dst.begin(), last = dst.end(); it != last; ++it)
(*it)->SetOwner(self, it);
};
copyLOT( *this, mSelf, that );
copyLOT( this->mPendingUpdates, mSelf, that.mPendingUpdates );
mUpdaters = that.mUpdaters;
}
void TrackList::Swap(TrackList &that)
{
auto SwapLOTs = [](