summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-05-30 10:02:29 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-05-31 10:28:26 +0200
commit288a3c2dde611086e6aa5d7a7a15729e027ae75f (patch)
tree6a257a865fa3f29c42a241b4c5e405faa3b07fe4 /sw
parentefc3412b1a86dfff56c49364efb36256d057a1e1 (diff)
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@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/IDocumentMarkAccess.hxx3
-rw-r--r--sw/source/core/doc/docbm.cxx8
2 files changed, 6 insertions, 5 deletions
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)
{
}