You can save boost::function in vector if you are not using std::find . Since you seem to need this, including a function in your class with equality would probably be the best.
class EventFun { int id_; boost::function<...> f_; public: ... bool operator==(const EventFun& o) const { return id_==o.id_; }
Note that this requires maintaining id_ reasonable way (for example, two different EventFun will have different id_ s, etc.).
Another possibility is to save boost::function with a tag that the client will remember and use to identify a specific function when it is deleted.
source share