From Jason Turner
Watch on YouTube

Summary

This episode explains the concept of higher-order functions in C++, defined as functions that either take functions as parameters or return functions as results. Jason demonstrates how to create a higher-order function that combines two functions by returning a lambda that applies them in sequence. He also illustrates how higher-order functions enable lazy evaluation patterns, where expensive computations can be set up but only executed when needed, and shows how the compiler optimizes such code, including tail call optimization.

Resources

Tags