If your array is unordered then you can just swap the end element down when erasing an element.
From my own code:
template<hxarray_concept_ T_, size_t capacity_>
void hxarray<T_, capacity_>::erase_unordered(const T_* pos_) {
hxassertmsg(pos_ >= this->data() && pos_ < m_end_, "invalid_iterator");
if(pos_ != --m_end_) {
*const_cast<T_*>(pos_) = hxmove(*m_end_);
}
m_end_->~T_();
}
This is something I think the std::vector could definitely use.