|
Boost Users : |
From: Alo Sarv (alo17_at_[hidden])
Date: 2004-11-12 15:45:17
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);
}
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net