[Libreoffice-commits] core.git: sw/inc sw/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Mon May 31 08:29:06 UTC 2021


 sw/inc/IDocumentMarkAccess.hxx |    3 ++-
 sw/source/core/doc/docbm.cxx   |    8 ++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

New commits:
commit 288a3c2dde611086e6aa5d7a7a15729e027ae75f
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Sun May 30 10:02:29 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon May 31 10:28:26 2021 +0200

    no need to allocate this separately
    
    Change-Id: Ia6ed82b67a412841e1559f385afec17da3852d7d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116399
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/inc/IDocumentMarkAccess.hxx b/sw/inc/IDocumentMarkAccess.hxx
index e678f52605ff..3a05a2053bbe 100644
--- a/sw/inc/IDocumentMarkAccess.hxx
+++ b/sw/inc/IDocumentMarkAccess.hxx
@@ -23,6 +23,7 @@
 #include <sal/types.h>
 #include "IMark.hxx"
 #include <memory>
+#include <optional>
 
 class SwPaM;
 struct SwPosition;
@@ -60,7 +61,7 @@ class IDocumentMarkAccess
         class SW_DLLPUBLIC iterator
         {
             private:
-                std::unique_ptr<std::vector<::sw::mark::MarkBase*>::const_iterator> m_pIter;
+                std::optional<std::vector<::sw::mark::MarkBase*>::const_iterator> m_pIter;
 
             public:
                 // MarkManager implementation needs to get the real iterator
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index d09bcb6e6046..825785fa9caa 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -60,18 +60,18 @@ IDocumentMarkAccess::iterator::get() const
 }
 
 IDocumentMarkAccess::iterator::iterator(std::vector<::sw::mark::MarkBase*>::const_iterator const& rIter)
-    : m_pIter(new std::vector<::sw::mark::MarkBase*>::const_iterator(rIter))
+    : m_pIter(rIter)
 {
 }
 
 IDocumentMarkAccess::iterator::iterator(iterator const& rOther)
-    : m_pIter(new std::vector<::sw::mark::MarkBase*>::const_iterator(*rOther.m_pIter))
+    : m_pIter(rOther.m_pIter)
 {
 }
 
 auto IDocumentMarkAccess::iterator::operator=(iterator const& rOther) -> iterator&
 {
-    m_pIter.reset(new std::vector<::sw::mark::MarkBase*>::const_iterator(*rOther.m_pIter));
+    m_pIter = rOther.m_pIter;
     return *this;
 }
 
@@ -120,7 +120,7 @@ bool IDocumentMarkAccess::iterator::operator!=(iterator const& rOther) const
 }
 
 IDocumentMarkAccess::iterator::iterator()
-    : m_pIter(new std::vector<::sw::mark::MarkBase*>::const_iterator())
+    : m_pIter(std::in_place)
 {
 }
 


More information about the Libreoffice-commits mailing list