signals and copy constructors



i know that this is more a libsigc++ question; but as gtkmm uses libsigc++ heavily and the libsigc++ mailinglist is not very populated i ask this question here too:

is there an elegant way to "change *p_obj in mem_fun(*p_obj, ...)" after the signal is allredy attached to a concrete object , so that when the copy constructor of that object is called, some_signal.emit(...) calls the method in the object created by this copy constructor call ? or is it better to think of a different design, so that this question doesn't come up ?

to avoid misunderstandigs, here is somekind of example:

//just a useless signal
sigc::signal<void> someSignal;

//just a useless class
class Useless : public sigc::trackable
{
   public:
   void call_me() { ... }
};

//a useless scope
....
{
   Useless u1;
   someSignal.connect(sigc::mem_fun(u1,  &Useless::call_me));
//ok now connected - but how can i automatically change the target object to u2 - so that u2.call_me() is called due someSignal.emit() ? Useless u2(u1); //imagine this call is made at a comletly different part in my programm - for example in a clone method ....
  ....
}
....







[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]