X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/f23b0fb864cb60978c1fcfd48d50f62dd054fe31..329535631662ebf730c23f762762d38bf16663c3:/examples/s4u/engine-filtering/s4u-engine-filtering.cpp diff --git a/examples/s4u/engine-filtering/s4u-engine-filtering.cpp b/examples/s4u/engine-filtering/s4u-engine-filtering.cpp index acc939126c..494030006a 100644 --- a/examples/s4u/engine-filtering/s4u-engine-filtering.cpp +++ b/examples/s4u/engine-filtering/s4u-engine-filtering.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2017-2018. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2017-2019. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -19,7 +19,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_engine_filtering, "Messages specific for this s namespace filter { /* First example of thing that we can use as a filtering criteria: a simple boolean function */ -static bool filter_speed_more_than_50Mf(simgrid::s4u::Host* host) +static bool filter_speed_more_than_50Mf(const simgrid::s4u::Host* host) { return host->get_speed() > 50E6; } @@ -29,11 +29,11 @@ static bool filter_speed_more_than_50Mf(simgrid::s4u::Host* host) */ class SingleCore { public: - bool operator()(simgrid::s4u::Host* host) { return host->get_core_count() == 1; } + bool operator()(const simgrid::s4u::Host* host) { return host->get_core_count() == 1; } }; /* This functor is a bit more complex, as it saves the current state when created. - * Then, it allows to easily retrieve the hosts which frequency changed since the functor creation. + * Then, it allows one to easily retrieve the hosts which frequency changed since the functor creation. */ class FrequencyChanged { std::map host_list; @@ -60,7 +60,7 @@ int main(int argc, char* argv[]) /* Use a lambda function to filter hosts: We only want multicore hosts */ XBT_INFO("Hosts currently registered with this engine: %zu", e.get_host_count()); std::vector list = - e.get_filtered_hosts([](simgrid::s4u::Host* host) { return host->get_core_count() > 1; }); + e.get_filtered_hosts([](const simgrid::s4u::Host* host) { return host->get_core_count() > 1; }); for (auto& host : list) XBT_INFO("The following hosts have more than one core: %s", host->get_cname());