Here is the widget testing function. The widget number is given to the constructor, and remembered internally in the object. When the object is used in the fashion of a function, by invoking the parenthesis operator, it will test the argument value against the stored widget id. If they match, we return a true value.
The ability to create special purpose predicates, such as this widget tester, and then use them with general purpose functions, such as find_if, is an extremely powerful programming technique.