#include #include std::function compose(std::function one, std::function two){ return [&one, &two](double x)->double {one(two(x));}; } int main(){ std::function f = std::bind(std::divides(), std::placeholders::_1, 2.0); std::cout << compose(f,f)(8) << std::endl; return 0; }