diff options
author | Michael Stahl <mstahl@redhat.com> | 2012-07-31 17:25:44 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-07-31 20:26:45 +0200 |
commit | 2815396a1813cb3956c5aba066de49a7f34bc657 (patch) | |
tree | 2d2699d458cee9af16532a758e66e12befc3f08a /sw | |
parent | b60285e916e1c4102ef990f9aacb85307973d55e (diff) |
_SetGetExpFlds: this looks simpler with upper_bound
Change-Id: I37dd291aaa229493141fbb8b426488e8e4427185
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/doc/docfld.cxx | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx index 6f1fdf6d72b5..aa5156e39ff8 100644 --- a/sw/source/core/doc/docfld.cxx +++ b/sw/source/core/doc/docfld.cxx @@ -1106,12 +1106,10 @@ void SwDoc::FldsToCalc( SwCalc& rCalc, const _SetGetExpFld& rToThisFld ) if( !pUpdtFlds->GetSortLst()->empty() ) { - _SetGetExpFlds::const_iterator itLast = pUpdtFlds->GetSortLst()->lower_bound( (_SetGetExpFld*)&rToThisFld ); - if (pUpdtFlds->GetSortLst()->end() != itLast && **itLast == rToThisFld) - { - ++itLast; - } - + _SetGetExpFlds::const_iterator const itLast = std::upper_bound( + pUpdtFlds->GetSortLst()->begin(), + pUpdtFlds->GetSortLst()->end(), + const_cast<_SetGetExpFld*>(&rToThisFld)); for( _SetGetExpFlds::const_iterator it = pUpdtFlds->GetSortLst()->begin(); it != itLast; ++it ) lcl_CalcFld( *this, rCalc, **it, pMgr ); } @@ -1154,14 +1152,10 @@ void SwDoc::FldsToExpand( SwHash**& ppHashTbl, sal_uInt16& rTblSize, ppHashTbl = new SwHash*[ rTblSize ]; memset( ppHashTbl, 0, sizeof( _HashStr* ) * rTblSize ); - _SetGetExpFlds::const_iterator itLast; - { - itLast = pUpdtFlds->GetSortLst()->lower_bound( (_SetGetExpFld*)&rToThisFld ); - if (pUpdtFlds->GetSortLst()->end() != itLast && **itLast == rToThisFld) - { - ++itLast; - } - } + _SetGetExpFlds::const_iterator const itLast = std::upper_bound( + pUpdtFlds->GetSortLst()->begin(), + pUpdtFlds->GetSortLst()->end(), + const_cast<_SetGetExpFld*>(&rToThisFld)); for( _SetGetExpFlds::const_iterator it = pUpdtFlds->GetSortLst()->begin(); it != itLast; ++it ) { |