From 142a39a459854e47f0b0d991ed87a5cb2bfb6724 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 5 May 2026 08:18:23 +0000 Subject: [PATCH 1/3] Initial plan From 779d451c871febbd699a282314086ab781ce3182 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 5 May 2026 08:21:46 +0000 Subject: [PATCH 2/3] Replace std::bind1st/bind2nd with C++11 lambdas and set CXX_STD=CXX17 Agent-Logs-Url: https://github.com/flr/FLasher/sessions/a4a30070-fc6f-4c8c-b140-b3fec11bf6db Co-authored-by: iagomosqueira <1029847+iagomosqueira@users.noreply.github.com> --- src/FLQuant_base.cpp | 32 ++++++++++++++++---------------- src/Makevars | 2 +- src/Makevars.win | 2 +- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/FLQuant_base.cpp b/src/FLQuant_base.cpp index 0fad7cc9..522567c7 100644 --- a/src/FLQuant_base.cpp +++ b/src/FLQuant_base.cpp @@ -637,7 +637,7 @@ FLQuant_base& FLQuant_base::operator *= (const FLQuant_base& rhs){ template FLQuant_base& FLQuant_base::operator *= (const T& rhs){ //Rprintf("In scalar T=*T multiplication assignment\n"); - std::transform((*this).data.begin(), (*this).data.end(), (*this).data.begin(), std::bind1st(std::multiplies(),rhs)); + std::transform((*this).data.begin(), (*this).data.end(), (*this).data.begin(), [rhs](const T& x){ return x * rhs; }); return *this; } @@ -648,7 +648,7 @@ template template FLQuant_base& FLQuant_base::operator *= (const T2& rhs){ //Rprintf("In scalar T=*T2 multiplication assignment\n"); - std::transform((*this).data.begin(), (*this).data.end(), (*this).data.begin(), std::bind1st(std::multiplies(),rhs)); + std::transform((*this).data.begin(), (*this).data.end(), (*this).data.begin(), [rhs](const T& x){ return x * rhs; }); return *this; } @@ -784,7 +784,7 @@ FLQuant_base& FLQuant_base::operator /= (const FLQuant_base& rhs){ // FLQuantAdolc / CppAD /= adouble template FLQuant_base& FLQuant_base::operator /= (const T& rhs){ - std::transform((*this).data.begin(), (*this).data.end(), (*this).data.begin(), std::bind2nd(std::divides(),rhs)); + std::transform((*this).data.begin(), (*this).data.end(), (*this).data.begin(), [rhs](const T& x){ return x / rhs; }); return *this; } @@ -794,7 +794,7 @@ FLQuant_base& FLQuant_base::operator /= (const T& rhs){ template template FLQuant_base& FLQuant_base::operator /= (const T2& rhs){ - std::transform((*this).data.begin(), (*this).data.end(), (*this).data.begin(), std::bind2nd(std::divides(),rhs)); + std::transform((*this).data.begin(), (*this).data.end(), (*this).data.begin(), [rhs](const T& x){ return x / rhs; }); return *this; } @@ -834,7 +834,7 @@ template FLQuant_base operator / (const T& lhs, const FLQuant_base& rhs){ FLQuant_base out = rhs; std::vector out_data = out.get_data(); - std::transform(out_data.begin(), out_data.end(), out_data.begin(), std::bind1st(std::divides(),lhs)); + std::transform(out_data.begin(), out_data.end(), out_data.begin(), [lhs](const T& x){ return lhs / x; }); out.set_data(out_data); return out; } @@ -843,7 +843,7 @@ template FLQuant_base operator / (const double& lhs, const FLQuant_base& rhs){ FLQuant_base out = rhs; std::vector out_data = out.get_data(); - std::transform(out_data.begin(), out_data.end(), out_data.begin(), std::bind1st(std::divides(),lhs)); + std::transform(out_data.begin(), out_data.end(), out_data.begin(), [lhs](const T& x){ return lhs / x; }); out.set_data(out_data); return out; } @@ -851,7 +851,7 @@ FLQuant_base operator / (const double& lhs, const FLQuant_base& rhs){ FLQuant_base operator / (const double& lhs, const FLQuant_base& rhs){ FLQuant_base out = rhs; std::vector out_data = out.get_data(); - std::transform(out_data.begin(), out_data.end(), out_data.begin(), std::bind1st(std::divides(),lhs)); + std::transform(out_data.begin(), out_data.end(), out_data.begin(), [lhs](const double& x){ return lhs / x; }); out.set_data(out_data); return out; } @@ -874,7 +874,7 @@ template FLQuant_base operator / (const T& lhs, const FLQuant_base& rhs){ FLQuant_base out(rhs); std::vector out_data = out.get_data(); - std::transform(out_data.begin(), out_data.end(), out_data.begin(), std::bind1st(std::divides(),lhs)); + std::transform(out_data.begin(), out_data.end(), out_data.begin(), [lhs](const T& x){ return lhs / x; }); out.set_data(out_data); return out; } @@ -925,7 +925,7 @@ FLQuant_base& FLQuant_base::operator -= (const FLQuant_base& rhs){ // FLQuantAdolc / CppAD -= adouble template FLQuant_base& FLQuant_base::operator -= (const T& rhs){ - std::transform((*this).data.begin(), (*this).data.end(), (*this).data.begin(), std::bind2nd(std::minus(),rhs)); + std::transform((*this).data.begin(), (*this).data.end(), (*this).data.begin(), [rhs](const T& x){ return x - rhs; }); return *this; } @@ -935,7 +935,7 @@ FLQuant_base& FLQuant_base::operator -= (const T& rhs){ template template FLQuant_base& FLQuant_base::operator -= (const T2& rhs){ - std::transform((*this).data.begin(), (*this).data.end(), (*this).data.begin(), std::bind2nd(std::minus(),rhs)); + std::transform((*this).data.begin(), (*this).data.end(), (*this).data.begin(), [rhs](const T& x){ return x - rhs; }); return *this; } @@ -975,7 +975,7 @@ template FLQuant_base operator - (const T& lhs, const FLQuant_base& rhs){ FLQuant_base out = rhs; std::vector out_data = out.get_data(); - std::transform(out_data.begin(), out_data.end(), out_data.begin(), std::bind1st(std::minus(),lhs)); + std::transform(out_data.begin(), out_data.end(), out_data.begin(), [lhs](const T& x){ return lhs - x; }); out.set_data(out_data); return out; } @@ -984,7 +984,7 @@ template FLQuant_base operator - (const double& lhs, const FLQuant_base& rhs){ FLQuant_base out = rhs; std::vector out_data = out.get_data(); - std::transform(out_data.begin(), out_data.end(), out_data.begin(), std::bind1st(std::minus(),lhs)); + std::transform(out_data.begin(), out_data.end(), out_data.begin(), [lhs](const T& x){ return lhs - x; }); out.set_data(out_data); return out; } @@ -992,7 +992,7 @@ FLQuant_base operator - (const double& lhs, const FLQuant_base& rhs){ FLQuant_base operator - (const double& lhs, const FLQuant_base& rhs){ FLQuant_base out = rhs; std::vector out_data = out.get_data(); - std::transform(out_data.begin(), out_data.end(), out_data.begin(), std::bind1st(std::minus(),lhs)); + std::transform(out_data.begin(), out_data.end(), out_data.begin(), [lhs](const double& x){ return lhs - x; }); out.set_data(out_data); return out; } @@ -1015,7 +1015,7 @@ template FLQuant_base operator - (const T& lhs, const FLQuant_base& rhs){ FLQuant_base out(rhs); std::vector out_data = out.get_data(); - std::transform(out_data.begin(), out_data.end(), out_data.begin(), std::bind1st(std::minus(),lhs)); + std::transform(out_data.begin(), out_data.end(), out_data.begin(), [lhs](const T& x){ return lhs - x; }); out.set_data(out_data); return out; } @@ -1068,7 +1068,7 @@ FLQuant_base& FLQuant_base::operator += (const FLQuant_base& rhs){ // FLQuantAdolc / CppAD += adouble template FLQuant_base& FLQuant_base::operator += (const T& rhs){ - std::transform((*this).data.begin(), (*this).data.end(), (*this).data.begin(), std::bind1st(std::plus(),rhs)); + std::transform((*this).data.begin(), (*this).data.end(), (*this).data.begin(), [rhs](const T& x){ return x + rhs; }); return *this; } @@ -1078,7 +1078,7 @@ FLQuant_base& FLQuant_base::operator += (const T& rhs){ template template FLQuant_base& FLQuant_base::operator += (const T2& rhs){ - std::transform((*this).data.begin(), (*this).data.end(), (*this).data.begin(), std::bind1st(std::plus(),rhs)); + std::transform((*this).data.begin(), (*this).data.end(), (*this).data.begin(), [rhs](const T& x){ return x + rhs; }); return *this; } diff --git a/src/Makevars b/src/Makevars index 3dea3012..c8e812a6 100644 --- a/src/Makevars +++ b/src/Makevars @@ -1,2 +1,2 @@ PKG_CXXFLAGS=-I../inst/include -DRCPP_USE_UNWIND_PROTECT -CXX_STD=CXX11 +CXX_STD=CXX17 diff --git a/src/Makevars.win b/src/Makevars.win index 3dea3012..c8e812a6 100644 --- a/src/Makevars.win +++ b/src/Makevars.win @@ -1,2 +1,2 @@ PKG_CXXFLAGS=-I../inst/include -DRCPP_USE_UNWIND_PROTECT -CXX_STD=CXX11 +CXX_STD=CXX17 From 5a4613c19cca45750d41df902363d7d66b7092fd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 5 May 2026 08:23:17 +0000 Subject: [PATCH 3/3] Preserve exact operand order for bind1st multiplies and plus lambdas Agent-Logs-Url: https://github.com/flr/FLasher/sessions/a4a30070-fc6f-4c8c-b140-b3fec11bf6db Co-authored-by: iagomosqueira <1029847+iagomosqueira@users.noreply.github.com> --- src/FLQuant_base.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/FLQuant_base.cpp b/src/FLQuant_base.cpp index 522567c7..75b4562e 100644 --- a/src/FLQuant_base.cpp +++ b/src/FLQuant_base.cpp @@ -637,7 +637,7 @@ FLQuant_base& FLQuant_base::operator *= (const FLQuant_base& rhs){ template FLQuant_base& FLQuant_base::operator *= (const T& rhs){ //Rprintf("In scalar T=*T multiplication assignment\n"); - std::transform((*this).data.begin(), (*this).data.end(), (*this).data.begin(), [rhs](const T& x){ return x * rhs; }); + std::transform((*this).data.begin(), (*this).data.end(), (*this).data.begin(), [rhs](const T& x){ return rhs * x; }); return *this; } @@ -648,7 +648,7 @@ template template FLQuant_base& FLQuant_base::operator *= (const T2& rhs){ //Rprintf("In scalar T=*T2 multiplication assignment\n"); - std::transform((*this).data.begin(), (*this).data.end(), (*this).data.begin(), [rhs](const T& x){ return x * rhs; }); + std::transform((*this).data.begin(), (*this).data.end(), (*this).data.begin(), [rhs](const T& x){ return rhs * x; }); return *this; } @@ -1068,7 +1068,7 @@ FLQuant_base& FLQuant_base::operator += (const FLQuant_base& rhs){ // FLQuantAdolc / CppAD += adouble template FLQuant_base& FLQuant_base::operator += (const T& rhs){ - std::transform((*this).data.begin(), (*this).data.end(), (*this).data.begin(), [rhs](const T& x){ return x + rhs; }); + std::transform((*this).data.begin(), (*this).data.end(), (*this).data.begin(), [rhs](const T& x){ return rhs + x; }); return *this; } @@ -1078,7 +1078,7 @@ FLQuant_base& FLQuant_base::operator += (const T& rhs){ template template FLQuant_base& FLQuant_base::operator += (const T2& rhs){ - std::transform((*this).data.begin(), (*this).data.end(), (*this).data.begin(), [rhs](const T& x){ return x + rhs; }); + std::transform((*this).data.begin(), (*this).data.end(), (*this).data.begin(), [rhs](const T& x){ return rhs + x; }); return *this; }