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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed Jul 21 12:02:37 UTC 2021


 sc/inc/columnspanset.hxx              |    3 ++-
 sc/source/core/data/columnspanset.cxx |    6 +++---
 2 files changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 99cd1d8834bb708afc81c825ff2b7992b7acb37d
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Jul 21 10:29:24 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Jul 21 14:02:03 2021 +0200

    flatten TableType in ColumnSpanSet
    
    Change-Id: I66c8a1ac022da0f64dc16fdda364da6402d3db30
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119307
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/inc/columnspanset.hxx b/sc/inc/columnspanset.hxx
index 547861d1c583..a5fed2d3f25a 100644
--- a/sc/inc/columnspanset.hxx
+++ b/sc/inc/columnspanset.hxx
@@ -11,6 +11,7 @@
 
 #include "address.hxx"
 
+#include <optional>
 #include <vector>
 #include <mdds/flat_segment_tree.hpp>
 
@@ -59,7 +60,7 @@ private:
         ColumnType(SCROW nStart, SCROW nEnd, bool bInit);
     };
 
-    typedef std::vector<std::unique_ptr<ColumnType>> TableType;
+    typedef std::vector<std::optional<ColumnType>> TableType;
 
     std::vector<TableType> maTables;
 
diff --git a/sc/source/core/data/columnspanset.cxx b/sc/source/core/data/columnspanset.cxx
index 8d9775e0cbfc..a38ea7fffe35 100644
--- a/sc/source/core/data/columnspanset.cxx
+++ b/sc/source/core/data/columnspanset.cxx
@@ -74,7 +74,7 @@ ColumnSpanSet::ColumnType& ColumnSpanSet::getColumn(const ScDocument& rDoc, SCTA
         rTab.resize(nCol+1);
 
     if (!rTab[nCol])
-        rTab[nCol].reset(new ColumnType(0, rDoc.MaxRow(), /*bInit*/false));
+        rTab[nCol].emplace(0, rDoc.MaxRow(), /*bInit*/false);
 
     return *rTab[nCol];
 }
@@ -156,7 +156,7 @@ void ColumnSpanSet::executeAction(Action& ac) const
                 continue;
 
             ac.startColumn(nTab, nCol);
-            ColumnType& rCol = *rTab[nCol];
+            const ColumnType& rCol = *rTab[nCol];
             ColumnSpansType::const_iterator it = rCol.maSpans.begin(), itEnd = rCol.maSpans.end();
             SCROW nRow1, nRow2;
             nRow1 = it->first;
@@ -199,7 +199,7 @@ void ColumnSpanSet::executeColumnAction(ScDocument& rDoc, ColumnAction& ac) cons
 
             ScColumn& rColumn = pTab->aCol[nCol];
             ac.startColumn(&rColumn);
-            ColumnType& rCol = *rTab[nCol];
+            const ColumnType& rCol = *rTab[nCol];
             ColumnSpansType::const_iterator it = rCol.maSpans.begin(), itEnd = rCol.maSpans.end();
             SCROW nRow1, nRow2;
             nRow1 = it->first;


More information about the Libreoffice-commits mailing list