| 479 | } |
| 480 | |
| 481 | void TrackList::Insert(const Track* before, |
| 482 | const Track::Holder &pSrc, bool assignIds) |
| 483 | { |
| 484 | assert(before == nullptr || Find(before) != EndIterator<const Track>()); |
| 485 | |
| 486 | if(before == nullptr) |
| 487 | { |
| 488 | Add(pSrc, assignIds); |
| 489 | return; |
| 490 | } |
| 491 | |
| 492 | std::vector<Track *> arr; |
| 493 | arr.reserve(Size() + 1); |
| 494 | for (const auto track : *this) { |
| 495 | if (track == before) |
| 496 | arr.push_back(pSrc.get()); |
| 497 | arr.push_back(track); |
| 498 | } |
| 499 | Add(pSrc, assignIds); |
| 500 | Permute(arr); |
| 501 | } |
| 502 | |
| 503 | void TrackList::Permute(const std::vector<Track *> &tracks) |
| 504 | { |
no test coverage detected