Boost logo

Boost Users :

From: Jesper Bojesen (jbb_at_[hidden])
Date: 2003-04-16 07:26:06


I have a problem with the sematics of the the signal connect method.
Consider this simple program:

#include <iostream>
#include <boost/signal.hpp>

struct HelloWorld {
  void operator()() const {
    std::cout << "Hello, World!, the parallel world exist at "
              << (void *) this
              << std::endl;
  }
};

int main () {
  // Connect a HelloWorld slot
  HelloWorld hello;
  std::cout << "Main world at " << (void *) &hello << std::endl;

  boost::signal<void ()> sig;
  sig.connect(hello);

  sig ();

  std::cout << "Thats all folks!\n";
  return 0;
}

It produces this output:

>Main world at 0xbffff2e0
>Hello, World!, the parallel world exist at 0x8056128
>Thats all folks!

My problem is that the object signalled is not the same object that I subscribed to the signal.

Is this really what was inteded ?

Is the any rationale behind this behaviour ?

-- 
Jesper Bojesen			Medical Insight
Email: 				jbb_at_[hidden]
Phone mobile:			(+45) 40 99 55 03
Phone direct:			(+45) 46 55 04 42
Fax:  				(+45) 46 55 11 66

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