18 Aug
2008
18 Aug
'08
8:33 p.m.
Christian Larsen:
int main() { typedef function
Listener; Listener a = listenerA; Listener b = listenerB;
bool equal;
// None of these compile: equal = (a == b); equal = function_equal(a, b); equal = a.contains(b); equal = a.contains(a);
return 0; }
As you've seen, 'a' contains listenerA. It's not possible to compare two boost::function objects for equality. Boost.Signals solves the 'remove' problem by returning a dedicated token from 'add' (boost::connection in its case) which you can then pass to 'remove'.