[Libreoffice-commits] .: o3tl/inc

Michael Stahl mst at kemper.freedesktop.org
Wed Jul 25 13:57:37 PDT 2012


 o3tl/inc/o3tl/sorted_vector.hxx |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

New commits:
commit 8f5b707d905f84f0102d1fdf365761ca03688742
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Jul 25 22:55:09 2012 +0200

    sorted_vector: removing the vector::ersase makes more sense
    
    Change-Id: Id70e87ab1b7f6a55ad2374cab05fa7f3bdef2cc4

diff --git a/o3tl/inc/o3tl/sorted_vector.hxx b/o3tl/inc/o3tl/sorted_vector.hxx
index 48ad0bc..0fe46cf 100644
--- a/o3tl/inc/o3tl/sorted_vector.hxx
+++ b/o3tl/inc/o3tl/sorted_vector.hxx
@@ -34,7 +34,6 @@ public:
     typedef typename std::vector<Value>::size_type size_type;
 
     using base_t::clear;
-    using base_t::erase;
     using base_t::empty;
     using base_t::size;
 
@@ -56,7 +55,7 @@ public:
         iterator it = lower_bound_nonconst( x );
         if (it != base_t::end() && !less_than(x, *it))
         {
-            erase( it );
+            base_t::erase(it);
             return 1;
         }
         return 0;
@@ -67,7 +66,12 @@ public:
         base_t::erase( begin_nonconst() + index );
     }
 
-    // hack: public erase with const_iterator, should not change sort order
+    // like C++ 2011: erase with const_iterator (doesn't change sort order)
+    void erase(const_iterator const& position)
+    {   // C++98 has vector::erase(iterator), so call that
+        base_t::erase(begin_nonconst() + (position - begin()));
+    }
+
     void erase(const_iterator const& first, const_iterator const& last)
     {
         base_t::erase(begin_nonconst() + (first - begin()),


More information about the Libreoffice-commits mailing list