From a2fc883173d7053cefe543620982051ae40c4b03 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 23 Jun 2020 15:02:35 +0200 Subject: use more std::container::insert instead of std::copy which is both more compact code, and more efficient, since the insert method can do smarter resizing Change-Id: I17f226660f87cdf002edccc29b4af8fd59a25f91 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96948 Tested-by: Jenkins Reviewed-by: Noel Grandin --- dbaccess/source/filter/xml/xmlExport.cxx | 2 +- dbaccess/source/ui/app/AppControllerDnD.cxx | 12 ++++-------- dbaccess/source/ui/relationdesign/RelationController.cxx | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-) (limited to 'dbaccess') diff --git a/dbaccess/source/filter/xml/xmlExport.cxx b/dbaccess/source/filter/xml/xmlExport.cxx index 64d84729c6e3..13b68d9f15bc 100644 --- a/dbaccess/source/filter/xml/xmlExport.cxx +++ b/dbaccess/source/filter/xml/xmlExport.cxx @@ -1215,7 +1215,7 @@ void ODBExport::exportAutoStyle(XPropertySet* _xProp) } if ( XmlStyleFamily::TABLE_CELL == i.second.second ) - std::copy( m_aCurrentPropertyStates.begin(), m_aCurrentPropertyStates.end(), std::back_inserter( aPropStates )); + aPropStates.insert( aPropStates.end(), m_aCurrentPropertyStates.begin(), m_aCurrentPropertyStates.end() ); if ( !aPropStates.empty() ) i.second.first->emplace( _xProp,GetAutoStylePool()->Add( i.second.second, aPropStates ) ); } diff --git a/dbaccess/source/ui/app/AppControllerDnD.cxx b/dbaccess/source/ui/app/AppControllerDnD.cxx index 98d622584494..6b0a17d05446 100644 --- a/dbaccess/source/ui/app/AppControllerDnD.cxx +++ b/dbaccess/source/ui/app/AppControllerDnD.cxx @@ -177,14 +177,10 @@ void OApplicationController::deleteObjects( ElementType _eType, const std::vecto // be the ancestor or child of another element from the list. // We want to ensure that ancestors get deleted first, so we normalize the list in this respect. // #i33353# - std::set< OUString > aDeleteNames; - // Note that this implicitly uses std::less< OUString > a comparison operation, which - // results in lexicographical order, which is exactly what we need, because "foo" is *before* - // any "foo/bar" in this order. - std::copy( - _rList.begin(), _rList.end(), - std::insert_iterator< std::set< OUString > >( aDeleteNames, aDeleteNames.begin() ) - ); + // Note that this implicitly uses std::less< OUString > a comparison operation, which + // results in lexicographical order, which is exactly what we need, because "foo" is *before* + // any "foo/bar" in this order. + std::set< OUString > aDeleteNames(_rList.begin(), _rList.end()); std::set< OUString >::size_type nCount = aDeleteNames.size(); for ( std::set< OUString >::size_type nObjectsLeft = nCount; !aDeleteNames.empty(); ) diff --git a/dbaccess/source/ui/relationdesign/RelationController.cxx b/dbaccess/source/ui/relationdesign/RelationController.cxx index 21a7c9e8bf96..a5229aebf230 100644 --- a/dbaccess/source/ui/relationdesign/RelationController.cxx +++ b/dbaccess/source/ui/relationdesign/RelationController.cxx @@ -423,7 +423,7 @@ void ORelationController::mergeData(const TTableConnectionData& _aConnectionData { ::osl::MutexGuard aGuard( getMutex() ); - std::copy( _aConnectionData.begin(), _aConnectionData.end(), std::back_inserter( m_vTableConnectionData )); + m_vTableConnectionData.insert( m_vTableConnectionData.end(), _aConnectionData.begin(), _aConnectionData.end() ); // here we are finished, so we can collect the table from connection data for (auto const& elem : m_vTableConnectionData) { -- cgit