Erase operations
| 640 | |
| 641 | // Erase operations |
| 642 | iterator erase(const_iterator pos) { |
| 643 | if (pos == end()) return end(); |
| 644 | |
| 645 | fl::size index = pos.mIndex; |
| 646 | |
| 647 | // Destroy element at pos |
| 648 | fl::size erase_idx = get_index(index); |
| 649 | mData[erase_idx].~T(); |
| 650 | |
| 651 | // Shift elements from pos+1 to end one position to the left |
| 652 | for (fl::size i = index; i < mSize - 1; ++i) { |
| 653 | fl::size from_idx = get_index(i + 1); |
| 654 | fl::size to_idx = get_index(i); |
| 655 | new (&mData[to_idx]) T(fl::move(mData[from_idx])); |
| 656 | mData[from_idx].~T(); |
| 657 | } |
| 658 | |
| 659 | --mSize; |
| 660 | return iterator(this, index); |
| 661 | } |
| 662 | |
| 663 | iterator erase(const_iterator first, const_iterator last) { |
| 664 | if (first == last) return iterator(this, first.mIndex); |