diff options
Diffstat (limited to 'sw/inc/doc.hxx')
-rw-r--r-- | sw/inc/doc.hxx | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index edf54f94f003..cfaefece1ed1 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -1644,14 +1644,14 @@ public: std::vector< std::weak_ptr<SwUnoCursor> > mvUnoCursorTable; // Remove expired UnoCursor weak pointers the document keeps to notify about document death. - void cleanupUnoCursorTable() + void cleanupUnoCursorTable() const { + auto & rTable = const_cast<SwDoc*>(this)->mvUnoCursorTable; // In most cases we'll remove most of the elements. - std::vector< std::weak_ptr<SwUnoCursor> > unoCursorTable; - std::copy_if(mvUnoCursorTable.begin(), mvUnoCursorTable.end(), - std::back_inserter(unoCursorTable), - [](const std::weak_ptr<SwUnoCursor>& pWeakPtr) { return !pWeakPtr.expired(); }); - std::swap(mvUnoCursorTable, unoCursorTable); + rTable.erase( std::remove_if(rTable.begin(), + rTable.end(), + [] (std::weak_ptr<SwUnoCursor> const & x) { return x.expired(); }), + rTable.end()); } private: |