From 2f0c10db707bbd11d8ca456bcf3d2559a1ce15dd Mon Sep 17 00:00:00 2001 From: Jochen Nitschke Date: Mon, 10 Jul 2017 21:49:59 +0200 Subject: simplify strip types from Sequence, related tdf#108782 Change-Id: Ia8bd4ead67183e7f56c804e949ac04c6451c5201 Reviewed-on: https://gerrit.libreoffice.org/39809 Reviewed-by: Noel Grandin Tested-by: Jenkins Reviewed-by: Jochen Nitschke --- dbaccess/source/ui/browser/unodatbr.cxx | 12 ++++-------- dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx | 14 +++++--------- 2 files changed, 9 insertions(+), 17 deletions(-) (limited to 'dbaccess') diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx index 547a9a012872..9d456cc11204 100644 --- a/dbaccess/source/ui/browser/unodatbr.cxx +++ b/dbaccess/source/ui/browser/unodatbr.cxx @@ -263,14 +263,10 @@ Sequence< Type > SAL_CALL SbaTableQueryBrowser::getTypes( ) OSL_PRECOND( !!m_aDocScriptSupport, "SbaTableQueryBrowser::getTypes: did not initialize this, yet!" ); if ( !m_aDocScriptSupport || !*m_aDocScriptSupport ) { - Sequence< Type > aStrippedTypes( aTypes.getLength() - 1 ); - std::remove_copy_if( - aTypes.begin(), - aTypes.end(), - aStrippedTypes.getArray(), - std::bind2nd( std::equal_to< Type >(), cppu::UnoType::get() ) - ); - aTypes = aStrippedTypes; + auto newEnd = std::remove_if( aTypes.begin(), aTypes.end(), + [](const Type& type) + { return type == cppu::UnoType::get(); } ); + aTypes.realloc( std::distance(aTypes.begin(), newEnd) ); } return aTypes; } diff --git a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx index 87d5be71f7c2..2e780c7a0b2a 100644 --- a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx +++ b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx @@ -226,15 +226,11 @@ namespace dbaui Sequence< Type > aTypes( DBSubComponentController_Base::getTypes() ); if ( !m_pImpl->documentHasScriptSupport() ) { - Sequence< Type > aStrippedTypes( aTypes.getLength() - 1 ); - std::remove_copy_if( - aTypes.begin(), - aTypes.end(), - aStrippedTypes.getArray(), - std::bind2nd( std::equal_to< Type >(), cppu::UnoType::get() ) - ); - aTypes = aStrippedTypes; - } + auto newEnd = std::remove_if( aTypes.begin(), aTypes.end(), + [](const Type& type) + { return type == cppu::UnoType::get(); } ); + aTypes.realloc( std::distance(aTypes.begin(), newEnd) ); + } return aTypes; } -- cgit