[Libreoffice-commits] .: sw/source
Caolán McNamara
caolan at kemper.freedesktop.org
Wed Jun 8 02:27:07 PDT 2011
sw/source/core/doc/docbm.cxx | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
New commits:
commit 96001f0f561d11ff273f45350b385e88bb51afdd
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Jun 8 10:23:22 2011 +0100
Effective STL Item 27
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 502d830..939bbd8 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -715,7 +715,11 @@ namespace sw { namespace mark
DdeBookmark* const pDdeBookmark = dynamic_cast<DdeBookmark*>(ppMark->get());
if(pDdeBookmark)
pDdeBookmark->DeregisterFromDoc(m_pDoc);
- m_vMarks.erase(m_vMarks.begin() + (ppMark - m_vMarks.begin())); // clumsy const-cast
+ //Effective STL Item 27, get a non-const iterator aI at the same
+ //position as const iterator ppMark was
+ iterator_t aI = m_vMarks.begin();
+ std::advance(aI, std::distance<const_iterator_t>(aI, ppMark));
+ m_vMarks.erase(aI);
}
void MarkManager::deleteMark(const IMark* const pMark)
More information about the Libreoffice-commits
mailing list