C++ Equivalent to Java Anonymous Inner Classes

The closest equivalent to Java anonymous inner classes in C++ is to use a private
class which implements the corresponding interface (but if the interface is a functional
interface, then the closest equivalent is to replace the functional interface with a
function pointer and the anonymous inner class with a lambda).