#include <iostream> #include <functional> using namespace std; static bool is_even(int i) { return i % 2 == 0; } template<typename T> void f(const T &d, function<bool(T)> f) { cout << (f(d) ? "true" : "false"); } int main() { f<int>(10, [](int e){ return e % 2 == 0; }); f<int>(10, is_even); return 0; }