#if (FOR_ALTERNATIVE == 0) for (std::vector::iterator it = projects_to_update.begin(); it != projects_to_update.end(); ++it) { Project* p = *it; p->contact_scheduler(); } #elif (FOR_ALTERNATIVE == 1) for (auto it = projects_to_update.begin(); it != projects_to_update.end(); ++it) { Project* p = *it; p->contact_scheduler(); } #elif (FOR_ALTERNATIVE == 2) for (Project* p : projects_to_update) { p->contact_scheduler(); } #elif (FOR_ALTERNATIVE == 3) class Updater { void operator()(Project* p) const { p->contact_scheduler(); } }; std::for_each(projects_to_update.begin(), projects_to_update.end(), Updater()); #elif (FOR_ALTERNATIVE == 4) std::for_each(projects_to_update.begin(), projects_to_update.end(), sigc::mem_fun(&Project::contact_scheduler)); #endif