summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2012-07-24 23:26:02 +0200
committerMichael Stahl <mstahl@redhat.com>2012-07-25 14:13:45 +0200
commit9532d9bc22b411f20d8203b9495aea2eae158e72 (patch)
treeda0fce8e75f4385ed000d45d8b29c56a773bf8e6
parent29ee386e41971a64874c508dbb09c76438b2d841 (diff)
sorted_vector: add erase(const_iterator) methods
Change-Id: I4709cfed8f4c5e61d18906dad2948f418409dc0c
-rw-r--r--o3tl/inc/o3tl/sorted_vector.hxx12
-rw-r--r--sw/source/core/doc/acmplwrd.cxx5
2 files changed, 16 insertions, 1 deletions
diff --git a/o3tl/inc/o3tl/sorted_vector.hxx b/o3tl/inc/o3tl/sorted_vector.hxx
index b3ffc4ff8d41..bf1cca5eb937 100644
--- a/o3tl/inc/o3tl/sorted_vector.hxx
+++ b/o3tl/inc/o3tl/sorted_vector.hxx
@@ -67,6 +67,18 @@ public:
base_t::erase( begin_nonconst() + index );
}
+ // hack: public erase with const_iterator, should not change sort order
+ void erase(const_iterator const& position)
+ {
+ base_t::erase(begin_nonconst() + (position - begin()));
+ }
+
+ void erase(const_iterator const& first, const_iterator const& last)
+ {
+ base_t::erase(begin_nonconst() + (first - begin()),
+ begin_nonconst() + (last - begin()));
+ }
+
// ACCESSORS
// Only return a const iterator, so that the vector cannot be directly updated.
diff --git a/sw/source/core/doc/acmplwrd.cxx b/sw/source/core/doc/acmplwrd.cxx
index 138dcd115f7e..87c070288412 100644
--- a/sw/source/core/doc/acmplwrd.cxx
+++ b/sw/source/core/doc/acmplwrd.cxx
@@ -318,8 +318,11 @@ void SwAutoCompleteWord::SetMaxCount( sal_uInt16 nNewMax )
sal_uInt16 nLRUIndex = nNewMax-1;
while( nNewMax < aWordLst.size() && nLRUIndex < aLRULst.size())
{
- SvStringsISortDtor::iterator it = aWordLst.find( aLRULst[ nLRUIndex++ ] );
+ SvStringsISortDtor::const_iterator it =
+ aWordLst.find( aLRULst[ nLRUIndex++ ] );
OSL_ENSURE( aWordLst.end() != it, "String not found" );
+ //FIXME this is utterly horrid: SwAutoCompleteString should
+ // NOT derive from String
SwAutoCompleteString* pDel = (SwAutoCompleteString*) *it;
aWordLst.erase( it );
delete pDel;