#include <functional>
#include <iostream>

template <typename Function, typename... Args>
auto f(Function func, Args... args) -> decltype(func(args...))
{
	auto f11 = std::bind(func, args...);
	f11();
}

int sum(int a, int b)
{
	return a + b; 
}

void print(const char* string)
{
	std::cout << string << std::endl;
}

int main(int argc, char ** argv)
{
	std::cout << f(sum, 1, 2) << std::endl;

	f([] (const char* additional, const char* more) {
		std::cout << "hello ( " << additional << ", " << more << " )" << std::endl;
	}, "additional text", "and one more");

	auto printFunction = std::bind(&print, std::placeholders::_1);
	
	printFunction("hello from print bind");
	
	f(print, "hello from print directly");

	f([&printFunction] (std::function<void(const char*)> printParamFunc) {
		 printParamFunc("hello from print from std::function");
	}, printFunction);
}