X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba.git/blobdiff_plain/43bc22b6612b96aae16aa8f955edfbfe83dab39b..20ee10ed13aee7d9fb9c844648d5159ed4a054d2:/loba_2besteffort.cpp?ds=sidebyside diff --git a/loba_2besteffort.cpp b/loba_2besteffort.cpp index 82fcd36..5573714 100644 --- a/loba_2besteffort.cpp +++ b/loba_2besteffort.cpp @@ -1,5 +1,4 @@ #include // std::isfinite -#include #include #include @@ -9,16 +8,14 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(loba); void loba_2besteffort::load_balance() { - using std::placeholders::_1; - using std::placeholders::_2; - pneigh_sort_by_load(std::less()); print_loads_p(false, xbt_log_priority_debug); double sum = get_load() + std::accumulate(pneigh.begin(), pneigh.end(), 0.0, - std::bind(std::plus(), _1, - std::bind(&neighbor::get_load, _2))); + [](double x, const neighbor* n) { + return x + n->get_load(); + }); double mean = sum / (pneigh.size() + 1); XBT_DEBUG("sum = %g ; mean = %g", sum, mean);