Use them to avoid name clash between several `compare' classes.
#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;
- std::sort(pneigh.begin(), pneigh.end(), compare());
+ std::sort(pneigh.begin(), pneigh.end(), pneigh_load_greater());
print_loads_p(false, xbt_log_priority_debug);
#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()
{
- std::sort(pneigh.begin(), pneigh.end(), compare());
+ std::sort(pneigh.begin(), pneigh.end(), pneigh_load_less());
print_loads_p(false, xbt_log_priority_debug);
real_load = load;
}
+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: