Effects : Erases the element at position pos. Throws : Nothing. Complexity : Linear to the elements between pos and the last element. Constant if pos is the last element.
| 2087 | //! <b>Complexity</b>: Linear to the elements between pos and the |
| 2088 | //! last element. Constant if pos is the last element. |
| 2089 | iterator erase(const_iterator position) |
| 2090 | { |
| 2091 | BOOST_ASSERT(this->priv_in_range(position)); |
| 2092 | const pointer p = vector_iterator_get_ptr(position); |
| 2093 | T *const pos_ptr = boost::movelib::to_raw_pointer(p); |
| 2094 | T *const end_ptr = this->priv_raw_end(); |
| 2095 | |
| 2096 | //Move elements forward and destroy last |
| 2097 | (void)::boost::container::move(pos_ptr + 1, end_ptr, pos_ptr); |
| 2098 | |
| 2099 | T *const last_ptr = end_ptr-1; |
| 2100 | if(!value_traits::trivial_dctr_after_move || pos_ptr == last_ptr){ |
| 2101 | allocator_traits_type::destroy(this->get_stored_allocator(), last_ptr); |
| 2102 | } |
| 2103 | --this->m_holder.m_size; |
| 2104 | return iterator(p); |
| 2105 | } |
| 2106 | |
| 2107 | //! <b>Effects</b>: Erases the elements pointed by [first, last). |
| 2108 | //! |
nothing calls this directly
no test coverage detected