Re: sigc::connection and std::vector






On Wed, Jan 22, 2014 at 9:01 PM, Phillip Susi <psusi ubuntu com> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

I have an object that I wanted to maintain a sigc::connection in and
disconnect it when the object is destroyed.  The object is also stored
in a std::vector, which seems to copy and destroy objects as needed
when resizing the array.  It looks like when this happens, and the
original object is destroyed, and disconnects the connection, it
breaks the connection even though the object has been copied,
including the connection.

Is sigc::connection not copy safe using ref counting?  How can you get
around this?

connections involves slots. slots involve objects. copying an object does nothing to existing slots that reference the original. if the original is destroyed, its slot will be invalidated.

using std:: container types with objects is, IMO, not recommended. use them with simple scalar (builtin) types, pointers and very lightweight objects only. 


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