Hi,
I am running the program below (Vista with boost 1.43, mingw/gcc 4.5.1).
I would expect slot.x to be 5 but it is zero.
Why boost::signal creates another instance of the slot object ?
What am I missing here ?
Thank you in advance for your attention,
Mau.
----------------------------------------------------------------
#include <iostream>
#include
struct S
{
int x;
S (): x(0) {}
void operator () (int i)
{
std::cout << "&slot1 = " << this << std::endl;
x = i;
std::cout << "slot1.x = " << this->x << std::endl;
}
};
int main ()
{
S slot;
boost::signal sig;
std::cout << "&slot2 = " << &slot << std::endl;
sig.connect (slot);
sig (5);
std::cout << "slot2.x = " << slot.x << std::endl;
return 0;
}
--------------------------------------------------------------------
Output:
&slot2 = 0x22fee4
&slot1 = 0x341448
slot1.x = 5
slot2.x = 0