Function parameters are an important tool for abstraction, because they provide the flexibility needed to use the same function in different contexts. Although these parameters are typically used to pass data, many programming languages allow functions to be passed through parameters to other functions. This enables a single abstract version of an algorithm to be specialized for many concrete situations. In this teaching demonstration, students will learn how to pass functions as arguments to other functions in C++, to design abstract algorithms that accept functions as parameters, and to specialize algorithms in the standard library by passing functions into them.
John Kloosterman is a Ph.D. candidate at the University of Michigan. His research focuses on the design of energy efficient processors, which extend battery life on phones and reduce the cost of operating data centers.