|
Boost Users : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2008-08-18 16:33:08
Christian Larsen:
> int main()
> {
> typedef function<void ()> 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'.
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