[sigc] Disconnection without objects [on 1.2.5]



Hi,

I'm relatively new to LibSigC++, so bear with me if this something
stupid I'm asking. I've read the docs and had a look to the source
code before posting here.

I would like to be able to disconnect a slot without keeping a
connection object. This should be possible for slots with an 
instance in it because the instance pointer is a unique key to 
the connection.

If I don't have this, I have in many place in my code to keep
record of the connection objects and this is really a pain and
it duplicates the bookkeeping of the connections which is 
already well done in LibSigC++, so should not be required.

So, to be more precise, I'd like this kind of behaviour:

class Emitter {
public:
  SigC::Signal0<void> changed;
};

class Receiver {
public:
  void connect() 
  {
    // connect the slot
    emitter_.changed.connect(SigC::slot(*this, &Receiver::onChanged));
  }
  
  void disconnect()
  {
    // disconnect the slot
    emitter_.changed.disconnect(SigC::slot(*this, &Receiver::onChanged));
  }
};

Is this feasible with the current version of the library (1.2.5), or how
difficult would it be to add this ?

Thanks !




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