| 687 | // Emplace operations |
| 688 | template<typename... Args> |
| 689 | iterator emplace(const_iterator pos, Args&&... args) { |
| 690 | fl::size index = pos.mIndex; |
| 691 | ensure_capacity(mSize + 1); |
| 692 | |
| 693 | // Shift elements from pos to end one position to the right |
| 694 | for (fl::size i = mSize; i > index; --i) { |
| 695 | fl::size from_idx = get_index(i - 1); |
| 696 | fl::size to_idx = get_index(i); |
| 697 | new (&mData[to_idx]) T(fl::move(mData[from_idx])); |
| 698 | mData[from_idx].~T(); |
| 699 | } |
| 700 | |
| 701 | // Construct new element in place |
| 702 | fl::size emplace_idx = get_index(index); |
| 703 | new (&mData[emplace_idx]) T(fl::forward<Args>(args)...); |
| 704 | ++mSize; |
| 705 | |
| 706 | return iterator(this, index); |
| 707 | } |
| 708 | |
| 709 | template<typename... Args> |
| 710 | T& emplace_back(Args&&... args) { |