I have the following:
typedef std::function event_type;
class Event : boost::noncopyable
{
private:
typedef std
You can store boost::function
in the vector, provided you don't use std::find
. Since you seem to need this, wrapping the function in its own class with equality would be probably the best.
class EventFun
{
int id_;
boost::function<...> f_;
public:
...
bool operator==(const EventFun& o) const { return id_==o.id_; } // you get it...
};
Note that this requires you maintain the id_
in a sane way (eg. two different EventFun
s will have different id_
s, etc.).
Another possibility would be to store boost::function
s with a tag the client would remember and use to identify the particular function on deleting it.