boost::function and equality operators?

Hi I was just transforming my event engine from another callback functors lib to boost::function, and discovered that boost::function has explicitly forbidden operator== and operator!=. My question is why is this done, and what could be possible workarounds? Thanks in advance, Alo Sarv. Example: #include <boost/function.hpp> #include <cassert> void foo() {} void bar() {} int main() { // won't compile if these are used in the below asserts // boost::function<void()> f(&foo); // boost::function<void()> g(&bar); // boost::function<void()> h(&foo); // works with raw function pointers void (*f)() = &foo; void (*g)() = &bar; void (*h)() = &foo; assert(f == h); assert(f != g); assert(g != h); }
participants (1)
-
Alo Sarv