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
<para>The only line I had to change was the signal line (in <literalremap="tt">run()</literal> I need to change
206
218
my code to supply the argument when I emit the signal too, but that's not shown
207
219
here).</para>
208
220
209
-
<para>The name of the type is '<literalremap="tt">sigc::signal</literal>'. The template parameters are the return type, then the argument types.</para>
221
+
<para>The name of the type is '<literalremap="tt">sigc::signal</literal>'.
222
+
The template parameters are the return type, then the argument types in parentheses.
223
+
(The parentheses are necessary in libsigc++3. If you use libsigc++2, the syntax
224
+
is different, with a comma between return type and parameter types.)</para>
210
225
211
226
<para>The types in the function signature are in the same order as the template
212
227
parameters, eg:</para>
213
228
214
229
<programlisting>
215
-
sigc::signal<void, std::string>
216
-
void function(std::string foo);
230
+
sigc::signal<void(std::string)>
231
+
void function(std::string foo);
217
232
</programlisting>
218
233
219
234
<para>So now you can update your alerter (for simplicity, lets go back to the
@@ -269,7 +284,7 @@ int main()
269
284
<para>A signal is an instance of a template, named <literalremap="tt">sigc::signal</literal>.
270
285
The template arguments are the types,
271
286
in the order they appear in the function signature that can be connected to that
272
-
signal; that is the return type, then the argument types.</para>
287
+
signal; that is the return type, then the argument types in parentheses.</para>
273
288
274
289
<para>To provide a signal for people to connect to, you must make available an
275
290
instance of that <literalremap="tt">sigc::signal</literal>. In <literalremap="tt">AlienDetector</literal> this was done
@@ -297,7 +312,7 @@ void AlienDetector::run()
297
312
{
298
313
sleep(3); // wait for aliens
299
314
signal_detected("the carpark"); // this is the std::string version, looks like
300
-
// they landed in the carpark afterall.
315
+
// they landed in the carpark after all.
301
316
}
302
317
</programlisting>
303
318
</sect1>
@@ -308,7 +323,7 @@ void AlienDetector::run()
308
323
about the return value of the last registered one, it's quite straightforward:</para>
0 commit comments