, , , , . :
template<class T> void f(T);
template<class T> void h(T);
void g() {
h(f);
h(f<int>);
h<void(int)>(f);
}
, , . print :
struct print {
template<typename T>
void operator()(T&& x) const {
std::cout << x;
}
};
execute :
template<class T, class Op>
void execute(T&& input, Op&& op) {
std::forward<Op>(op)(std::forward<T>(input));
}
void g() { execute(1, print{}); }
Generic lambdas (++ 14) :
execute(1, [] (auto&& x) { std::cout << x; });