diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2022-09-01 21:45:18 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-09-02 19:05:50 +0200 |
commit | 7d5beaabeac4e474512337b086690257daeefc96 (patch) | |
tree | 773cf58c629ddfe25a9da335664e2366290ef369 /sc/source | |
parent | a3b1c886227af1b117783bc569d32675441cd3fd (diff) |
no need to use unique_ptr for this map in sc::FormulaGroupAreaListener
map is already a node based data structure, so the values will stay
in the same place in memory
Change-Id: If9bc02d702fd5ba9994e606744b63494fbe20edd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139237
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/core/data/formulacell.cxx | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 0bad3e6b73d1..9754ab340188 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -553,23 +553,25 @@ sc::FormulaGroupAreaListener* ScFormulaCellGroup::getAreaListener( if (it == m_AreaListeners.end() || m_AreaListeners.key_comp()(aKey, it->first)) { // Insert a new one. - it = m_AreaListeners.insert( - it, std::make_pair(aKey, std::make_unique<sc::FormulaGroupAreaListener>( - rRange, (*ppTopCell)->GetDocument(), (*ppTopCell)->aPos, mnLength, bStartFixed, bEndFixed))); + it = m_AreaListeners.emplace_hint( + it, std::piecewise_construct, + std::forward_as_tuple(aKey), + std::forward_as_tuple( + rRange, (*ppTopCell)->GetDocument(), (*ppTopCell)->aPos, mnLength, bStartFixed, bEndFixed)); } - return it->second.get(); + return &it->second; } void ScFormulaCellGroup::endAllGroupListening( ScDocument& rDoc ) { - for (const auto& rEntry : m_AreaListeners) + for (auto& rEntry : m_AreaListeners) { - sc::FormulaGroupAreaListener *const pListener = rEntry.second.get(); - ScRange aListenRange = pListener->getListeningRange(); + sc::FormulaGroupAreaListener& rListener = rEntry.second; + ScRange aListenRange = rListener.getListeningRange(); // This "always listen" special range is never grouped. bool bGroupListening = (aListenRange != BCA_LISTEN_ALWAYS); - rDoc.EndListeningArea(aListenRange, bGroupListening, pListener); + rDoc.EndListeningArea(aListenRange, bGroupListening, &rListener); } m_AreaListeners.clear(); |