To get a better feeling of the challenges this presents in C++, try to re-write your Python example using [type hints](https://docs.python.org/3/library/typing.html). Even though it seems "impossible" to solve for the general case, in C++ you can do it in many ways. Some background here, function composition the way you use it here to feed the result of the leftmost operation to the operation on its right is a "left fold" operator and if you're willing to venture into functional programming lands writing the following is doable: ```cpp auto cfs = compose(f1, f2, f3); std::cout << cfs(2, 3) << std::endl; ``` i.e. even having varying number of inputs, as long as the call chain can be composed. I've written a series of articles on the topic years ago, probably [this](https://ngathanasiou.wordpress.com/2016/11/23/compose-and-curry-as-folds/) is mostly to the point. That said, you can also avoid the "functional nuances" and start from scratch using some cool C++20 features. Here is the centerpiece of a general function composer: ```cpp template <class... F> auto composer(F&&... args) { return [...functions = args](auto x) { return recurse_invoke(x, functions...); }; } ``` which you'd use as: ```cpp // Store the composed function or call it right away. composer(lambda1, lambda2, lambda3)(42); ``` The composer uses a C++20 variadic capture clause, which allows it to manage chains of arbitrary length. Of course, a proper implementation would handle argument forwarding, which is shown in the following [Demo](http://coliru.stacked-crooked.com/a/c66dad59e3720c1e) A slight variation which needs no helper functions etc is: ```cpp template <class F, class... Fs> auto composer(F&& arg, Fs&&... args) { return [fun = std::forward<F>(arg), ...functions = std::forward<Fs>(args) ]<class X>(X&& x) mutable { if constexpr (sizeof...(Fs)) { return composer(std::forward<Fs>(functions)...)( std::invoke(std::forward<F>(fun), std::forward<X>(x))); } else { return std::invoke(std::forward<F>(fun), std::forward<X>(x)); } }; } ``` [Demo](http://coliru.stacked-crooked.com/a/5f331861de341b37)