Function Composition from C++17 to C++23 C++23 code capsules trace the evolution of function composition from C++17 to C++23, building a reusable Composer class that grows cleaner with each standard. The journey highlights how C++ adopted functional programming concepts like right folds, moving from a function-type parameterization in C++17 to a value-type parameterization in C++20, with further improvements expected in C++23. C++23 Code Capsules Mathematicians and programmers alike have always known that functions are things you can do things with , not just things you call . One of the most natural operations on functions is composition: given f and g, form the new function f ∘ g where f ∘ g x = f g x . Chain enough of these together and you have a pipeline — a sequence of transformations applied one after another. Functional programmers have known this for decades. In Standard ML, folding a list of functions over an initial value is idiomatic and concise: ML: apply a list of functions right-to-left fun compose fs x = foldr fn f, acc = f acc x fs foldr processes the list from the right, threading an accumulator through each function in turn. The result is function composition expressed as a fold — \ f 1 f 2 ...f n x ... \ — and the combining function takes element, accumulator in right-to-left order. C++, being based on a procedural language that put performance first, took a longer road to arrive at the same idea. But arrive it did. This capsule traces that journey across three standards, building a reusable Composer class that grows cleaner at each step. Here is a first cut, written in C++17: // Makes the function type generic include