]> AND Private Git Repository - loba.git/blobdiff - cost_func.cpp
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
Save notes for pstar.
[loba.git] / cost_func.cpp
index d6cba8c88ed667484b1f6af6ce0b95a3ec9244da..4248c5654c568221667a5afd21169941ffec6c4e 100644 (file)
@@ -1,5 +1,4 @@
 #include <algorithm>
-#include <functional>
 #include <numeric>
 #include <iterator>
 #include <sstream>
@@ -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<double>(),
-                                     std::bind(std::multiplies<double>(),
-                                               amount, _1), _2));
+                           [&amount](double a, double b) {
+                               return amount * a + b;
+                           });
 }
 
 std::string cost_func::to_string()