boost function ==
Dear all,
We all waited for the operator==. Unfortunately it does not compile on VC++
7.1. What do I wrong:
namespace Tstb
{
int f0 ();
int f1 (int a);
int f2 (int a, int b);
int f3 (int a, int b, int c);
}
void Test
{
boost::function
gast128 wrote:
Dear all,
We all waited for the operator==. Unfortunately it does not compile on VC++ 7.1. What do I wrong:
namespace Tstb { int f0 (); int f1 (int a); int f2 (int a, int b); int f3 (int a, int b, int c); }
void Test { boost::function
fc1 = &Tstb::f0; boost::function fc2 = &Tstb::f0; boost::function fc3 = boost::bind(&Tstb::f1, 2); bool b = false;
b = (fc1 == fc2); b = (fc1 == fc3); b = (fc2 == fc3); }
You've been mislead by the name. function::operator== is not an operator==.
Here's how it's supposed to be used:
boost::function
Wkr, me
:-(
Ok thank you. We use boost function also as a client defined callback. Because there is no operator==, it is very hard to unregister. So we came up with a solution probably comparable to the signals unregister solution. Wkr, me
On Dec 15, 2004, at 12:47 PM, gast128 wrote:
Ok thank you. We use boost function also as a client defined callback. Because there is no operator==, it is very hard to unregister. So we came up with a solution probably comparable to the signals unregister solution.
Are you sure that the provided operator== doesn't work? The motivation
for this formulation of operator== (other than the unimplementability
of the general case) was that it solved Herb Sutter's "delegate"
problem. For instance, you can write this:
template<typename Signature>
class delegate
{
typedef boost::function<Signature> callback_type;
std::list
participants (3)
-
Doug Gregor
-
gast128
-
Peter Dimov