From 2484de6728bd11bb7949003d112f1ece2223c7a1 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Thu, 14 Oct 2021 09:25:24 +0200 Subject: Remove non-const Sequence::begin()/end() in internal code ... to avoid hidden cost of multiple COW checks, because they call getArray() internally. This obsoletes [loplugin:sequenceloop]. Also rename toNonConstRange to asNonConstRange, to reflect that the result is a view of the sequence, not an independent object. TODO: also drop non-const operator[], but introduce operator[] in SequenceRange. Change-Id: Idd5fd7a3400fe65274d2a6343025e2ef8911635d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123518 Tested-by: Jenkins Reviewed-by: Stephan Bergmann Reviewed-by: Mike Kaganski --- extensions/source/propctrlr/formcomponenthandler.cxx | 2 +- extensions/source/propctrlr/stringrepresentation.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'extensions') diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx index a005a33e7019..bf3feb4acb1a 100644 --- a/extensions/source/propctrlr/formcomponenthandler.cxx +++ b/extensions/source/propctrlr/formcomponenthandler.cxx @@ -814,7 +814,7 @@ namespace pcr PropertyId nPropId( 0 ); OUString sDisplayName; - for ( Property & rProperty : aAllProperties ) + for ( Property & rProperty : asNonConstRange(aAllProperties) ) { nPropId = m_pInfoService->getPropertyId( rProperty.Name ); if ( nPropId == -1 ) diff --git a/extensions/source/propctrlr/stringrepresentation.cxx b/extensions/source/propctrlr/stringrepresentation.cxx index 073cbbedd130..da468e5b51ef 100644 --- a/extensions/source/propctrlr/stringrepresentation.cxx +++ b/extensions/source/propctrlr/stringrepresentation.cxx @@ -255,7 +255,7 @@ void SAL_CALL StringRepresentation::initialize(const uno::Sequence< uno::Any > & uno::Sequence< uno::Reference< reflection::XConstantTypeDescription > > cs(m_xTypeDescription->getConstants()); - auto [begin, end] = toNonConstRange(cs); + auto [begin, end] = asNonConstRange(cs); std::sort(begin, end, CompareConstants()); m_aConstants = cs; } -- cgit