std::bind returns the object by value (the exact type of the object is a detail of the standard library implementation). This object saves all the necessary state, and its destructor performs all the necessary cleaning.
Note that your vector does not save pointers - it stores std::function objects. The std::function object internally saves the object from which it was created (the function pointer or the object returned by std::bind in your case), and its destructor correctly destroys the saved object. Destroying a function pointer does nothing. Destroying an object of a class type calls its destructor.
Angew
source share