#include <iostream>
template <void (*function)()>
struct A {
static void call() {
function();
}
};
void test() {
std::cout << "function" << std::endl;
}
int main() {
A<test>::call();
/* does not work
A<[](){
std::cout << "lambda" << std::endl;
}>::call();
*/
return 0;
}
#include <iostream>
template <class Body>
void call(const Body& body) {
body();
};
void test() {
std::cout << "function" << std::endl;
}
int main() {
call(test);
call([]() {
std::cout << "lambda" << std::endl;
});
return 0;
}