forms/source/xforms/binding.cxx | 15 ++- sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx | 50 ++++++++-- svl/source/numbers/zforlist.cxx | 40 ++++++-- 3 files changed, 84 insertions(+), 21 deletions(-)
New commits: commit 5a3dd3f0b1e83eca0984b2458fc0f6ee2eb49e4e Author: Karthik <m...@karthikreddy.org> AuthorDate: Tue Mar 4 07:19:28 2025 +0530 Commit: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org> CommitDate: Fri Mar 21 10:38:43 2025 +0100 tdf#165233 Use lambdas instead of std::bind Change-Id: I1aad4c456ee171b569b49de326c53380d73da071 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182448 Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org> Tested-by: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org> Tested-by: Jenkins diff --git a/forms/source/xforms/binding.cxx b/forms/source/xforms/binding.cxx index 40dd16586227..ba622e4036e1 100644 --- a/forms/source/xforms/binding.cxx +++ b/forms/source/xforms/binding.cxx @@ -644,13 +644,22 @@ void Binding::valueModified() Reference<XInterface> xSource = static_cast<XPropertySet*>( this ); ::std::for_each( maModifyListeners.begin(), maModifyListeners.end(), - ::std::bind( lcl_modified, std::placeholders::_1, xSource ) ); + [xSource](const css::uno::Reference<css::util::XModifyListener>& xListener) + { + return lcl_modified(xListener, xSource); + }); ::std::for_each( maListEntryListeners.begin(), maListEntryListeners.end(), - ::std::bind( lcl_listentry, std::placeholders::_1, xSource ) ); + [xSource](const css::uno::Reference<css::form::binding::XListEntryListener>& xListener) + { + return lcl_listentry(xListener,xSource); + }); ::std::for_each( maValidityListeners.begin(), maValidityListeners.end(), - ::std::bind( lcl_validate, std::placeholders::_1, xSource ) ); + [xSource](const css::uno::Reference<css::form::validation::XValidityConstraintListener>& xListener) + { + lcl_validate(xListener, xSource); + }); // now distribute MIPs to children if( xNode.is() ) diff --git a/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx b/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx index 2c68f18255b7..9b43f462b194 100644 --- a/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx @@ -187,70 +187,100 @@ void ScRandomNumberGeneratorDialog::SelectGeneratorAndGenerateNumbers() case DIST_UNIFORM: { std::uniform_real_distribution<> distribution(parameter1, parameter2); - auto rng = std::bind(distribution, seed); + auto rng = [&distribution, seed]() mutable + { + return distribution(seed); + }; GenerateNumbers(rng, STR_DISTRIBUTION_UNIFORM_REAL, aDecimalPlaces); break; } case DIST_UNIFORM_INTEGER: { std::uniform_int_distribution<sal_Int64> distribution(parameterInteger1, parameterInteger2); - auto rng = std::bind(distribution, seed); + auto rng = [&distribution, seed]() mutable + { + return distribution(seed); + }; GenerateNumbers(rng, STR_DISTRIBUTION_UNIFORM_INTEGER, aDecimalPlaces); break; } case DIST_NORMAL: { std::normal_distribution<> distribution(parameter1, parameter2); - auto rng = std::bind(distribution, seed); + auto rng = [&distribution, seed]() mutable + { + return distribution(seed); + }; GenerateNumbers(rng, STR_DISTRIBUTION_NORMAL, aDecimalPlaces); break; } case DIST_CAUCHY: { std::cauchy_distribution<> distribution(parameter1); - auto rng = std::bind(distribution, seed); + auto rng = [&distribution, seed]() mutable + { + return distribution(seed); + }; GenerateNumbers(rng, STR_DISTRIBUTION_CAUCHY, aDecimalPlaces); break; } case DIST_BERNOULLI: { std::bernoulli_distribution distribution(parameter1); - auto rng = std::bind(distribution, seed); + auto rng = [&distribution, seed]() mutable + { + return distribution(seed); + }; GenerateNumbers(rng, STR_DISTRIBUTION_BERNOULLI, aDecimalPlaces); break; } case DIST_BINOMIAL: { std::binomial_distribution<> distribution(parameterInteger2, parameter1); - auto rng = std::bind(distribution, seed); + auto rng = [&distribution, seed]() mutable + { + return distribution(seed); + }; GenerateNumbers(rng, STR_DISTRIBUTION_BINOMIAL, aDecimalPlaces); break; } case DIST_CHI_SQUARED: { std::chi_squared_distribution<> distribution(parameter1); - auto rng = std::bind(distribution, seed); + auto rng = [&distribution, seed]() mutable + { + return distribution(seed); + }; GenerateNumbers(rng, STR_DISTRIBUTION_CHI_SQUARED, aDecimalPlaces); break; } case DIST_GEOMETRIC: { std::geometric_distribution<> distribution(parameter1); - auto rng = std::bind(distribution, seed); + auto rng = [&distribution, seed]() mutable + { + return distribution(seed); + }; GenerateNumbers(rng, STR_DISTRIBUTION_GEOMETRIC, aDecimalPlaces); break; } case DIST_NEGATIVE_BINOMIAL: { std::negative_binomial_distribution<> distribution(parameterInteger2, parameter1); - auto rng = std::bind(distribution, seed); + auto rng = [&distribution, seed]() mutable + { + return distribution(seed); + }; GenerateNumbers(rng, STR_DISTRIBUTION_NEGATIVE_BINOMIAL, aDecimalPlaces); break; } case DIST_POISSON: { std::poisson_distribution<> distribution(parameter1); - auto rng = std::bind(distribution, seed); + auto rng = [&distribution, seed]() mutable + { + return distribution(seed); + }; GenerateNumbers(rng, STR_DISTRIBUTION_POISSON, aDecimalPlaces); break; } diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index a9e2f00fc79b..3eb48c09f823 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -3970,10 +3970,22 @@ SvNFEngine::Accessor SvNFEngine::GetRWPolicy(SvNFFormatData& rFormatData) { return { - std::bind(SvNFEngine::GetCLOffsetRW, std::ref(rFormatData), std::placeholders::_1, std::placeholders::_2, std::placeholders::_3), - std::bind(SvNFEngine::CacheFormatRW, std::ref(rFormatData), std::placeholders::_1, std::placeholders::_2), - std::bind(SvNFEngine::FindFormatRW, std::ref(rFormatData), std::placeholders::_1), - std::bind(SvNFEngine::DefaultCurrencyRW, std::ref(rFormatData), std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4) + [&rFormatData](SvNFLanguageData& rCurrentLanguage, const NativeNumberWrapper& rNatNum, LanguageType eLnge) + { + return SvNFEngine::GetCLOffsetRW(rFormatData, rCurrentLanguage, rNatNum, eLnge); + }, + [&rFormatData](sal_uInt32 nSearch, sal_uInt32 nFormat) + { + return SvNFEngine::CacheFormatRW(rFormatData, nSearch, nFormat); + }, + [&rFormatData](sal_uInt32 nSearch) + { + return SvNFEngine::FindFormatRW(rFormatData, nSearch); + }, + [&rFormatData](SvNFLanguageData& rCurrentLanguage, const NativeNumberWrapper& rNatNum, sal_uInt32 CLOffset, LanguageType eLnge) + { + return SvNFEngine::DefaultCurrencyRW(rFormatData, rCurrentLanguage, rNatNum, CLOffset, eLnge); + } }; } @@ -3993,10 +4005,22 @@ SvNFEngine::Accessor SvNFEngine::GetROPolicy(const SvNFFormatData& rFormatData, assert(g_CurrencyTableInitialized && "ensure PrepForRoMode is called"); return { - std::bind(SvNFEngine::GetCLOffsetRO, std::ref(rFormatData), std::placeholders::_1, std::placeholders::_2, std::placeholders::_3), - std::bind(SvNFEngine::CacheFormatRO, std::ref(rFormatCache), std::placeholders::_1, std::placeholders::_2), - std::bind(SvNFEngine::FindFormatRO, std::ref(rFormatData), std::ref(rFormatCache), std::placeholders::_1), - std::bind(SvNFEngine::DefaultCurrencyRO, std::ref(rFormatData), std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4) + [&rFormatData](SvNFLanguageData& rCurrentLanguage, const NativeNumberWrapper& rNatNum, LanguageType eLnge) + { + return SvNFEngine::GetCLOffsetRO(rFormatData, rCurrentLanguage, rNatNum, eLnge); + }, + [&rFormatCache](sal_uInt32 nSearch, sal_uInt32 nFormat) + { + return SvNFEngine::CacheFormatRO(rFormatCache, nSearch, nFormat); + }, + [&rFormatData, rFormatCache](sal_uInt32 nSearch) + { + return SvNFEngine::FindFormatRO(rFormatData, rFormatCache, nSearch); + }, + [&rFormatData](SvNFLanguageData& rCurrentLanguage, const NativeNumberWrapper& rNatNum, sal_uInt32 CLOffset, LanguageType eLnge) + { + return SvNFEngine::DefaultCurrencyRO(rFormatData, rCurrentLanguage, rNatNum, CLOffset, eLnge); + } }; }