Functional programming with tuples of functions in c++