Skip to content

Commit 793d066

Browse files
db-srckjellahl
authored andcommitted
manual: Add paragraph about new scoped_connection
1 parent f6b0db5 commit 793d066

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

docs/docs/manual/libsigc_manual.xml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,13 +258,19 @@ int main()
258258

259259
<section xml:id="sect-disconnecting">
260260
<info><title>Disconnecting</title></info>
261-
262261
<para>If you decide you no longer want your code to be called whenever a signal is
263262
emitted, you must remember the return value of <literal remap="tt">connect()</literal>, which we've been
264263
ignoring until now.</para>
265264

266265
<para><literal remap="tt">connect()</literal> returns a <literal remap="tt">sigc::connection</literal> object, which has a <literal remap="tt">disconnect()</literal> member method. This does just what you think it does.</para>
267266

267+
<para>Also, sigc++ 3.6 adds <literal remap="tt">sigc::scoped_connection</literal>.
268+
A scoped connection can be constructed or assigned from a normal/unscoped <literal remap="tt">sigc::connection</literal>,
269+
whereupon it effectively takes ownership of the connection, and will automatically <literal remap="tt">disconnect()</literal>
270+
it when the <literal remap="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 <literal remap="tt">std::shared_ptr</literal>.
273+
See the <literal remap="tt">sigc::scoped_connection</literal> class documentation for examples.</para>
268274
</section>
269275
</chapter>
270276

@@ -431,7 +437,6 @@ asignal.connect( sigc::retype( sigc::ptr_fun(&amp;dostuff) ) );
431437

432438
<chapter xml:id="chapter-reference">
433439
<info><title>Reference</title></info>
434-
435440
<para>See the reference documentation <link xlink:href="https://libsigcplusplus.github.io/libsigcplusplus/reference/html/">online</link></para>
436441
</chapter>
437442
</book>

0 commit comments

Comments
 (0)