summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
54b3749)
Use them to avoid name clash between several `compare' classes.
#include "loba_fairstrategy.h"
#include "loba_fairstrategy.h"
-class compare {
-public:
- bool operator()(const neighbor*a, const neighbor*b) {
- return a->get_load() > b->get_load();
- }
-};
-
void loba_fairstrategy::load_balance()
{
const double delta = 0.001;
void loba_fairstrategy::load_balance()
{
const double delta = 0.001;
- std::sort(pneigh.begin(), pneigh.end(), compare());
+ std::sort(pneigh.begin(), pneigh.end(), pneigh_load_greater());
print_loads_p(false, xbt_log_priority_debug);
print_loads_p(false, xbt_log_priority_debug);
#include "loba_makhoul.h"
#include "loba_makhoul.h"
-class compare {
-public:
- bool operator()(const neighbor*a, const neighbor*b) {
- return a->get_load() < b->get_load();
- }
-};
-
void loba_makhoul::load_balance()
{
void loba_makhoul::load_balance()
{
- std::sort(pneigh.begin(), pneigh.end(), compare());
+ std::sort(pneigh.begin(), pneigh.end(), pneigh_load_less());
print_loads_p(false, xbt_log_priority_debug);
print_loads_p(false, xbt_log_priority_debug);
+struct pneigh_load_less {
+ bool operator()(const neighbor* a, const neighbor* b)
+ {
+ return a->get_load() < b->get_load();
+ }
+};
+
+struct pneigh_load_greater {
+ bool operator()(const neighbor* a, const neighbor* b)
+ {
+ return a->get_load() > b->get_load();
+ }
+};
+
#endif // !PROCESS_H
// Local variables:
#endif // !PROCESS_H
// Local variables: