You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docs/manual/libsigc_manual.xml
+7-2Lines changed: 7 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -258,13 +258,19 @@ int main()
258
258
259
259
<sectionxml:id="sect-disconnecting">
260
260
<info><title>Disconnecting</title></info>
261
-
262
261
<para>If you decide you no longer want your code to be called whenever a signal is
263
262
emitted, you must remember the return value of <literalremap="tt">connect()</literal>, which we've been
264
263
ignoring until now.</para>
265
264
266
265
<para><literalremap="tt">connect()</literal> returns a <literalremap="tt">sigc::connection</literal> object, which has a <literalremap="tt">disconnect()</literal> member method. This does just what you think it does.</para>
A scoped connection can be constructed or assigned from a normal/unscoped <literalremap="tt">sigc::connection</literal>,
269
+
whereupon it effectively takes ownership of the connection, and will automatically <literalremap="tt">disconnect()</literal>
270
+
it when the <literalremap="tt">sigc::scoped_connection</literal> is destroyed (goes out of scope) or reassigned.
271
+
This lets you tie whether a slot is called to the lifetime of a scoped connection object, e.g. as a class member,
272
+
instead of having to manually disconnect. Scoped connections can be put in containers, or made ref-counted via <literalremap="tt">std::shared_ptr</literal>.
273
+
See the <literalremap="tt">sigc::scoped_connection</literal> class documentation for examples.</para>
0 commit comments