X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba.git/blobdiff_plain/10e5dbdfc7cf72a000a90a2f1a27c7dc30364761..f581799445893c1b953c365fbfb025e3dbcc775a:/cost_func.cpp?ds=inline diff --git a/cost_func.cpp b/cost_func.cpp index d6cba8c..4248c56 100644 --- a/cost_func.cpp +++ b/cost_func.cpp @@ -1,5 +1,4 @@ #include -#include #include #include #include @@ -30,12 +29,10 @@ cost_func::~cost_func() double cost_func::operator()(double amount) const { - using std::placeholders::_1; - using std::placeholders::_2; return std::accumulate(++factors.begin(), factors.end(), factors.front(), - std::bind(std::plus(), - std::bind(std::multiplies(), - amount, _1), _2)); + [&amount](double a, double b) { + return amount * a + b; + }); } std::string cost_func::to_string()