| 344 | #endif |
| 345 | |
| 346 | void TrackList::Swap(TrackList &that) |
| 347 | { |
| 348 | auto SwapLOTs = []( |
| 349 | ListOfTracks &a, const std::weak_ptr< TrackList > &aSelf, |
| 350 | ListOfTracks &b, const std::weak_ptr< TrackList > &bSelf ) |
| 351 | { |
| 352 | a.swap(b); |
| 353 | for (auto it = a.begin(), last = a.end(); it != last; ++it) |
| 354 | (*it)->SetOwner(aSelf, it); |
| 355 | for (auto it = b.begin(), last = b.end(); it != last; ++it) |
| 356 | (*it)->SetOwner(bSelf, it); |
| 357 | }; |
| 358 | |
| 359 | const auto self = shared_from_this(); |
| 360 | const auto otherSelf = that.shared_from_this(); |
| 361 | SwapLOTs( *this, self, that, otherSelf ); |
| 362 | } |
| 363 | |
| 364 | TrackList::~TrackList() |
| 365 | { |