[Libreoffice-commits] core.git: comphelper/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Wed Aug 11 11:23:40 UTC 2021
comphelper/source/container/enumerablemap.cxx | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
New commits:
commit d39d87bbffe8e731bad92f2fe90526c3610689f5
Author: Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Tue Aug 10 19:54:28 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Aug 11 13:23:08 2021 +0200
no need to allocate KeyedValues separately
Change-Id: If28471436d224e88dfee07f3b8465648867197fd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120291
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/comphelper/source/container/enumerablemap.cxx b/comphelper/source/container/enumerablemap.cxx
index ae6053d7520c..a8897c293da4 100644
--- a/comphelper/source/container/enumerablemap.cxx
+++ b/comphelper/source/container/enumerablemap.cxx
@@ -39,6 +39,7 @@
#include <cmath>
#include <map>
#include <memory>
+#include <optional>
#include <utility>
namespace comphelper
@@ -89,7 +90,7 @@ namespace comphelper
{
Type m_aKeyType;
Type m_aValueType;
- std::unique_ptr< KeyedValues > m_pValues;
+ std::optional< KeyedValues > m_pValues;
std::shared_ptr< IKeyPredicateLess > m_pKeyCompare;
bool m_bMutable;
std::vector< MapEnumerator* > m_aModListeners;
@@ -102,11 +103,11 @@ namespace comphelper
MapData( const MapData& _source )
:m_aKeyType( _source.m_aKeyType )
,m_aValueType( _source.m_aValueType )
- ,m_pValues( new KeyedValues( *_source.m_pValues ) )
,m_pKeyCompare( _source.m_pKeyCompare )
,m_bMutable( false )
,m_aModListeners()
{
+ m_pValues.emplace( *_source.m_pValues );
}
private:
MapData& operator=( const MapData& _source ) = delete;
@@ -356,7 +357,7 @@ namespace comphelper
m_aData.m_aKeyType = aKeyType;
m_aData.m_aValueType = aValueType;
m_aData.m_pKeyCompare = std::move(pComparator);
- m_aData.m_pValues.reset( new KeyedValues( *m_aData.m_pKeyCompare ) );
+ m_aData.m_pValues.emplace( *m_aData.m_pKeyCompare );
m_aData.m_bMutable = bMutable;
if ( aInitialValues.hasElements() )
More information about the Libreoffice-commits
mailing list