#include #include #include "Function.hpp" int main() { Function f; if (!f) std::cout << "Egyelőre nullptr" << std::endl; f = sin; std::cout << sin(2.3) << "==" << f(2.3) << std::endl; f = [] (double x) { return x*x; }; std::cout << 2.3*2.3 << "==" << f(2.3) << std::endl; f = std::bind(pow, std::placeholders::_1, 4); std::cout << pow(2.3, 4) << "==" << f(2.3) << std::endl; f = nullptr; try { f(2.3); } catch (std::bad_function_call &e) { std::cout << "Megint nullptr" << std::endl; } }