From: Arnaud Giersch Date: Mon, 23 May 2011 06:44:37 +0000 (+0200) Subject: It is useless to mention "tr1", now that compilation is done with -std=c++0x. X-Git-Tag: v0.1~62^2~12 X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba.git/commitdiff_plain/10e5dbdfc7cf72a000a90a2f1a27c7dc30364761?ds=sidebyside;hp=3c8c4916710f8dea39786aaffca1edbccd1397a7 It is useless to mention "tr1", now that compilation is done with -std=c++0x. --- diff --git a/communicator.cpp b/communicator.cpp index 867d19e..e6a47b4 100644 --- a/communicator.cpp +++ b/communicator.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include @@ -24,9 +24,8 @@ namespace { communicator::communicator() : host(static_cast(MSG_host_get_data(MSG_host_self()))) { - using std::tr1::bind; receiver_thread = new_msg_thread("receiver", - bind(&communicator::receiver, this)); + std::bind(&communicator::receiver, this)); receiver_thread->start(); } diff --git a/cost_func.cpp b/cost_func.cpp index 12c20f6..d6cba8c 100644 --- a/cost_func.cpp +++ b/cost_func.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include #include @@ -30,13 +30,12 @@ cost_func::~cost_func() double cost_func::operator()(double amount) const { - using std::tr1::bind; - using std::tr1::placeholders::_1; - using std::tr1::placeholders::_2; + using std::placeholders::_1; + using std::placeholders::_2; return std::accumulate(++factors.begin(), factors.end(), factors.front(), - bind(std::plus(), - bind(std::multiplies(), amount, _1), - _2)); + std::bind(std::plus(), + std::bind(std::multiplies(), + amount, _1), _2)); } std::string cost_func::to_string() diff --git a/deployment.cpp b/deployment.cpp index 705c1ea..8f52806 100644 --- a/deployment.cpp +++ b/deployment.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include #include @@ -50,8 +50,7 @@ void deployment_generator::set_link(int host1, int host2) void deployment_generator::distribute_load() { - using std::tr1::bind; - using std::tr1::placeholders::_1; + using std::placeholders::_1; if (!opt::auto_depl::random_distribution) { set_load(0, opt::auto_depl::load); @@ -63,7 +62,7 @@ void deployment_generator::distribute_load() double factor = opt::auto_depl::load / std::accumulate(loads.begin(), loads.end(), 0.0); std::transform(loads.begin(), loads.end(), loads.begin(), - bind(std::multiplies(), _1, factor)); + std::bind(std::multiplies(), _1, factor)); for (unsigned i = 0 ; i < hosts.size() ; ++i) set_load(i, loads[i]); } diff --git a/hostdata.cpp b/hostdata.cpp index 17d7a08..ee8fadc 100644 --- a/hostdata.cpp +++ b/hostdata.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include #include @@ -16,18 +16,18 @@ std::vector hostdata::hosts; void hostdata::create() { - using std::tr1::bind; - using std::tr1::placeholders::_1; - using std::tr1::placeholders::_2; + using std::placeholders::_1; + using std::placeholders::_2; int nhosts = MSG_get_host_number(); m_host_t* host_list = MSG_get_host_table(); // only sort hosts for automatically created deployment if (opt::auto_depl::enabled) std::sort(host_list, host_list + nhosts, - bind(std::less(), bind(strcmp, - bind(MSG_host_get_name, _1), - bind(MSG_host_get_name, _2)), 0)); + std::bind(std::less(), + std::bind(strcmp, + std::bind(MSG_host_get_name, _1), + std::bind(MSG_host_get_name, _2)), 0)); hosts.assign(host_list, host_list + nhosts); xbt_free(host_list); diff --git a/process.cpp b/process.cpp index 54fea8a..b36b000 100644 --- a/process.cpp +++ b/process.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include #include @@ -58,8 +58,7 @@ process::process(int argc, char* argv[]) comp_iter = lb_iter = 0; lb_thread = new_msg_thread("loba", - std::tr1::bind(&process::load_balance_loop, - this)); + std::bind(&process::load_balance_loop, this)); e_xbt_log_priority_t logp = xbt_log_priority_verbose; if (!LOG_ISENABLED(logp)) @@ -70,7 +69,7 @@ process::process(int argc, char* argv[]) oss << ESSE(neigh.size()) << ": "; std::transform(neigh.begin(), neigh.end() - 1, std::ostream_iterator(oss, ", "), - std::tr1::mem_fn(&neighbor::get_name)); + std::mem_fn(&neighbor::get_name)); oss << neigh.back().get_name(); } XBT_LOG(logp, "Got %s.", oss.str().c_str()); @@ -112,8 +111,7 @@ int process::run() void process::load_balance_loop() { - using std::tr1::bind; - using std::tr1::placeholders::_1; + using std::placeholders::_1; double next_iter_after_date = MSG_get_clock() + opt::min_lb_iter_duration; while (still_running()) { @@ -144,7 +142,7 @@ void process::load_balance_loop() // send comm.ctrl_flush(false); std::for_each(neigh.begin(), neigh.end(), - bind(&process::ctrl_send, this, _1)); + std::bind(&process::ctrl_send, this, _1)); prev_load_broadcast = expected_load; mutex.release(); @@ -156,7 +154,7 @@ void process::load_balance_loop() XBT_DEBUG("send CTRL_CLOSE to %zu neighbor%s", neigh.size(), ESSE(neigh.size())); std::for_each(neigh.begin(), neigh.end(), - bind(&process::ctrl_close, this, _1)); + std::bind(&process::ctrl_close, this, _1)); while (ctrl_close_pending) { comm.ctrl_flush(false); XBT_DEBUG("waiting for %d CTRL CLOSE", ctrl_close_pending); @@ -167,8 +165,7 @@ void process::load_balance_loop() void process::compute_loop() { - using std::tr1::bind; - using std::tr1::placeholders::_1; + using std::placeholders::_1; double next_iter_after_date = MSG_get_clock() + opt::min_comp_iter_duration; while (still_running()) { @@ -184,7 +181,7 @@ void process::compute_loop() comm.data_flush(false); mutex.acquire(); std::for_each(neigh.begin(), neigh.end(), - bind(&process::data_send, this, _1)); + std::bind(&process::data_send, this, _1)); mutex.release(); if (real_load == 0.0) @@ -206,13 +203,13 @@ void process::compute_loop() XBT_VERB("Going to finalize for %s...", __func__); // last send, for not losing load scheduled to be sent std::for_each(neigh.begin(), neigh.end(), - bind(&process::data_send, this, _1)); + std::bind(&process::data_send, this, _1)); finalizing = true; total_load_running -= real_load; XBT_DEBUG("send DATA_CLOSE to %zu neighbor%s", neigh.size(), ESSE(neigh.size())); std::for_each(neigh.begin(), neigh.end(), - bind(&process::data_close, this, _1)); + std::bind(&process::data_close, this, _1)); while (data_close_pending) { comm.data_flush(false); XBT_DEBUG("waiting for %d DATA CLOSE", data_close_pending); @@ -265,13 +262,12 @@ bool process::still_running() double process::get_sum_of_to_send() const { - using std::tr1::bind; - using std::tr1::placeholders::_1; - using std::tr1::placeholders::_2; + using std::placeholders::_1; + using std::placeholders::_2; return std::accumulate(neigh.begin(), neigh.end(), 0.0, - bind(std::plus(), - _1, bind(&neighbor::get_to_send, _2))); + std::bind(std::plus(), _1, + std::bind(&neighbor::get_to_send, _2))); } void process::load_balance() @@ -410,12 +406,11 @@ void process::handle_message(message* msg, m_host_t from) #define print_loads_generic(vec, verbose, logp, cat) \ if (_XBT_LOG_ISENABLEDV((*cat), logp)) { \ - using std::tr1::bind; \ - using std::tr1::placeholders::_1; \ + using std::placeholders::_1; \ XBT_XCLOG(cat, logp, "My load: %g (real); %g (expected). " \ "Neighbor loads:", real_load, expected_load); \ std::for_each(vec.begin(), vec.end(), \ - bind(&neighbor::print, _1, verbose, logp, cat)); \ + std::bind(&neighbor::print, _1, verbose, logp, cat)); \ } else ((void)0) void process::print_loads(bool verbose, diff --git a/process.h b/process.h index ed6e6cf..4686af4 100644 --- a/process.h +++ b/process.h @@ -5,10 +5,10 @@ //#undef USE_UNORDERED_MAP #include -#include +#include #ifdef USE_UNORDERED_MAP -# include -# define MAP_TEMPLATE std::tr1::unordered_map +# include +# define MAP_TEMPLATE std::unordered_map #else # include # define MAP_TEMPLATE std::map @@ -169,13 +169,12 @@ private: template void process::pneigh_sort_by_load(const Compare& comp) { - using std::tr1::bind; - using std::tr1::placeholders::_1; - using std::tr1::placeholders::_2; + using std::placeholders::_1; + using std::placeholders::_2; std::sort(pneigh.begin(), pneigh.end(), - bind(comp, - bind(&neighbor::get_load, _1), - bind(&neighbor::get_load, _2))); + std::bind(comp, + std::bind(&neighbor::get_load, _1), + std::bind(&neighbor::get_load, _2))); } #endif // !PROCESS_H