#include #include int add(int a, int b) { return a + b; } struct Multiply { int operator()(int a, int b) { return a * b; } }; int main() { // Store a regular function std::function f1 = add; std::cout << "Result of add(5, 3): " << f1(5, 3) << std::endl; //R(Args...) //std::function< R(Args...) > f1a = add; // Store a lambda expression std::function f2 = [](int a, int b) { return a - b; }; std::cout << "Result of lambda (-5, 3): " << f2(-5, 3) << std::endl; // Store a function object Multiply multiplier; std::function f3 = multiplier; std::cout << "Result of Multiply(7, 4): " << f3(7, 4) << std::endl; //Store a function pointer int(*func_ptr)(int, int) = add; std::function f4 = func_ptr; std::cout << "Result of func_ptr(10, 2): " << f4(10, 2) << std::endl; return 0; }