X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba.git/blobdiff_plain/80a1fe1a200a4309c36598571b1f4ccb76a8788f..f964322c1d9ba6560da668bef1880e4cd01b7a79:/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()