diff options
author | Doug Gilbert <dgilbert@us.ibm.com> | 2012-03-05 17:24:31 -0600 |
---|---|---|
committer | Bradley W. Bishop <bradleyb@us.ibm.com> | 2012-03-06 23:00:55 -0600 |
commit | 630f7ba9928d0cd9a6e80a0635269dc83c9ecd64 (patch) | |
tree | 49d4e58c14976a7f2609d09776c1d1dd2098f2e8 /src/include/vector | |
parent | c556e10089a39c5fbb67073c4355c0a9d0981920 (diff) | |
download | talos-hostboot-630f7ba9928d0cd9a6e80a0635269dc83c9ecd64.tar.gz talos-hostboot-630f7ba9928d0cd9a6e80a0635269dc83c9ecd64.zip |
Add return of an iterator to the vector erase function to match the stl standard.
Change-Id: I383a147976bb6203f6426c22279f9ad6dc80b46e
RTC: 37922
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/722
Tested-by: Jenkins Server
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Reviewed-by: Bradley W. Bishop <bradleyb@us.ibm.com>
Diffstat (limited to 'src/include/vector')
-rw-r--r-- | src/include/vector | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/include/vector b/src/include/vector index 4d52d8a44..4827116dc 100644 --- a/src/include/vector +++ b/src/include/vector @@ -505,24 +505,30 @@ namespace std /** * Remove an element from the container * @param[in] position iterator, position of element to remove + * @return new location of the element that followed the last + * element erased, or end() if the operation erased + * the last element in the sequence. * @pre begin() <= position < end() * @post All previously obtained iterators are invalid. */ __attribute__ ((always_inline)) - void erase(iterator position) + iterator erase(iterator position) { - erase(position,position+1); + return erase(position,position+1); } /** * Remove a slice of elements from the container * @param[in] first iterator, postion of the first element to remove * @param[in] last iterator, postion of the last element + 1 to remove + * @return new location of the element that followed the last + * element erased, or end() if the operation erased + * the last element in the sequence. * @pre begin() <= first,last <= end(), first < last. * @post All previously obtained iterators are invalid. * @note The element pointed to be last is not deleted. */ - void erase(iterator first, iterator last) + iterator erase(iterator first, iterator last) { assert(last >= first); assert(first >= iv_start); @@ -530,12 +536,13 @@ namespace std assert(last > iv_start); assert(last <= iv_finish); - first = copy(last,iv_finish,first); - while(first != iv_finish) + last = copy(last,iv_finish,first); + while(last != iv_finish) { --iv_finish; iv_finish->~T(); } + return first; } |