]> git.tdb.fi Git - ext/sigc++-2.0.git/blob - untracked/sigc++/functors/slot.h
Import libsigc++ 2.10.8 sources
[ext/sigc++-2.0.git] / untracked / sigc++ / functors / slot.h
1 // -*- c++ -*-
2 /* Do not edit! -- generated file */
3 #ifndef _SIGC_FUNCTORS_SLOT_H_
4 #define _SIGC_FUNCTORS_SLOT_H_
5 #include <sigc++/trackable.h>
6 #include <sigc++/visit_each.h>
7 #include <sigc++/adaptors/adaptor_trait.h>
8 #include <sigc++/functors/slot_base.h>
9
10 //TODO: See comment in functor_trait.h.
11 #if defined(nil) && defined(SIGC_PRAGMA_PUSH_POP_MACRO)
12   #define SIGC_NIL_HAS_BEEN_PUSHED 1
13   #pragma push_macro("nil")
14   #undef nil
15 #endif
16
17 namespace sigc {
18
19 namespace internal {
20
21 // Conversion between different types of function pointers with
22 // reinterpret_cast can make gcc8 print a warning.
23 // https://github.com/libsigcplusplus/libsigcplusplus/issues/1
24 // https://github.com/libsigcplusplus/libsigcplusplus/issues/8
25 /** Returns the supplied function pointer, cast to a pointer to another function type.
26  *
27  * When a single reinterpret_cast between function pointer types causes a
28  * compiler warning or error, this function may work.
29  *
30  * Qualify calls with namespace names: sigc::internal::function_pointer_cast<>().
31  * If you don't, indirect calls from another library that also contains a
32  * function_pointer_cast<>() (perhaps glibmm), can be ambiguous due to ADL
33  * (argument-dependent lookup).
34  */
35 template <typename T_out, typename T_in>
36 inline T_out function_pointer_cast(T_in in)
37 {
38   // The double reinterpret_cast suppresses a warning from gcc8 with the
39   // -Wcast-function-type option.
40   return reinterpret_cast<T_out>(reinterpret_cast<void (*)()>(in));
41 }
42
43 /** A typed slot_rep.
44  * A typed slot_rep holds a functor that can be invoked from
45  * slot::operator()(). visit_each() is used to visit the functor's
46  * targets that inherit trackable recursively and register the
47  * notification callback. Consequently the slot_rep object will be
48  * notified when some referred object is destroyed or overwritten.
49  */
50 template <class T_functor>
51 struct typed_slot_rep : public slot_rep
52 {
53   typedef typed_slot_rep<T_functor> self;
54
55   /* Use an adaptor type so that arguments can be passed as const references
56    * through explicit template instantiation from slot_call#::call_it() */
57   typedef typename adaptor_trait<T_functor>::adaptor_type adaptor_type;
58
59   /** The functor contained by this slot_rep object. */
60   adaptor_type functor_;
61
62   /** Constructs an invalid typed slot_rep object.
63    * The notification callback is registered using visit_each().
64    * @param functor The functor contained by the new slot_rep object.
65    */
66   inline typed_slot_rep(const T_functor& functor)
67     : slot_rep(nullptr, &destroy, &dup), functor_(functor)
68     { sigc::visit_each_type<trackable*>(slot_do_bind(this), functor_); }
69
70   inline typed_slot_rep(const typed_slot_rep& cl)
71     : slot_rep(cl.call_, &destroy, &dup), functor_(cl.functor_)
72     { sigc::visit_each_type<trackable*>(slot_do_bind(this), functor_); }
73
74   typed_slot_rep& operator=(const typed_slot_rep& src) = delete;
75
76   typed_slot_rep(typed_slot_rep&& src) = delete;
77   typed_slot_rep& operator=(typed_slot_rep&& src) = delete;
78
79   inline ~typed_slot_rep()
80     {
81       call_ = nullptr;
82       destroy_ = nullptr;
83       sigc::visit_each_type<trackable*>(slot_do_unbind(this), functor_);
84     }
85
86   /** Detaches the stored functor from the other referred trackables and destroys it.
87    * This does not destroy the base slot_rep object.
88    */
89   static void* destroy(void* data)
90     {
91       self* self_ = static_cast<self*>(reinterpret_cast<slot_rep*>(data));
92       self_->call_ = nullptr;
93       self_->destroy_ = nullptr;
94       sigc::visit_each_type<trackable*>(slot_do_unbind(self_), self_->functor_);
95       self_->functor_.~adaptor_type();
96       /* don't call disconnect() here: destroy() is either called
97        * a) from the parent itself (in which case disconnect() leads to a segfault) or
98        * b) from a parentless slot (in which case disconnect() does nothing)
99        */
100       return nullptr;
101     }
102
103   /** Makes a deep copy of the slot_rep object.
104    * Deep copy means that the notification callback of the new
105    * slot_rep object is registered in the referred trackables.
106    * @return A deep copy of the slot_rep object.
107    */
108   static void* dup(void* data)
109     {
110       slot_rep* a_rep = reinterpret_cast<slot_rep*>(data);
111       return static_cast<slot_rep*>(new self(*static_cast<self*>(a_rep)));
112     }
113 };
114
115 /** Abstracts functor execution.
116  * call_it() invokes a functor of type @e T_functor with a list of
117  * parameters whose types are given by the template arguments.
118  * address() forms a function pointer from call_it().
119  *
120  * The following template arguments are used:
121  * - @e T_functor The functor type.
122  * - @e T_return The return type of call_it().
123  *
124  */
125 template<class T_functor, class T_return>
126 struct slot_call0
127 {
128   /** Invokes a functor of type @p T_functor.
129    * @param rep slot_rep object that holds a functor of type @p T_functor.
130    * @return The return values of the functor invocation.
131    */
132   static T_return call_it(slot_rep* rep)
133     {
134       typedef typed_slot_rep<T_functor> typed_slot;
135       typed_slot *typed_rep = static_cast<typed_slot*>(rep);
136       return (typed_rep->functor_)();
137     }
138
139   /** Forms a function pointer from call_it().
140    * @return A function pointer formed from call_it().
141    */
142   static hook address()
143   { return sigc::internal::function_pointer_cast<hook>(&call_it); }
144 };
145
146 /** Abstracts functor execution.
147  * call_it() invokes a functor of type @e T_functor with a list of
148  * parameters whose types are given by the template arguments.
149  * address() forms a function pointer from call_it().
150  *
151  * The following template arguments are used:
152  * - @e T_functor The functor type.
153  * - @e T_return The return type of call_it().
154  * - @e T_arg1 Argument type used in the definition of call_it().
155  *
156  */
157 template<class T_functor, class T_return, class T_arg1>
158 struct slot_call1
159 {
160   /** Invokes a functor of type @p T_functor.
161    * @param rep slot_rep object that holds a functor of type @p T_functor.
162    * @param _A_a1 Argument to be passed on to the functor.
163    * @return The return values of the functor invocation.
164    */
165   static T_return call_it(slot_rep* rep, type_trait_take_t<T_arg1> a_1)
166     {
167       typedef typed_slot_rep<T_functor> typed_slot;
168       typed_slot *typed_rep = static_cast<typed_slot*>(rep);
169       return (typed_rep->functor_).SIGC_WORKAROUND_OPERATOR_PARENTHESES<type_trait_take_t<T_arg1>>
170                (a_1);
171     }
172
173   /** Forms a function pointer from call_it().
174    * @return A function pointer formed from call_it().
175    */
176   static hook address()
177   { return sigc::internal::function_pointer_cast<hook>(&call_it); }
178 };
179
180 /** Abstracts functor execution.
181  * call_it() invokes a functor of type @e T_functor with a list of
182  * parameters whose types are given by the template arguments.
183  * address() forms a function pointer from call_it().
184  *
185  * The following template arguments are used:
186  * - @e T_functor The functor type.
187  * - @e T_return The return type of call_it().
188  * - @e T_arg1 Argument type used in the definition of call_it().
189  * - @e T_arg2 Argument type used in the definition of call_it().
190  *
191  */
192 template<class T_functor, class T_return, class T_arg1, class T_arg2>
193 struct slot_call2
194 {
195   /** Invokes a functor of type @p T_functor.
196    * @param rep slot_rep object that holds a functor of type @p T_functor.
197    * @param _A_a1 Argument to be passed on to the functor.
198    * @param _A_a2 Argument to be passed on to the functor.
199    * @return The return values of the functor invocation.
200    */
201   static T_return call_it(slot_rep* rep, type_trait_take_t<T_arg1> a_1, type_trait_take_t<T_arg2> a_2)
202     {
203       typedef typed_slot_rep<T_functor> typed_slot;
204       typed_slot *typed_rep = static_cast<typed_slot*>(rep);
205       return (typed_rep->functor_).SIGC_WORKAROUND_OPERATOR_PARENTHESES<type_trait_take_t<T_arg1>, type_trait_take_t<T_arg2>>
206                (a_1, a_2);
207     }
208
209   /** Forms a function pointer from call_it().
210    * @return A function pointer formed from call_it().
211    */
212   static hook address()
213   { return sigc::internal::function_pointer_cast<hook>(&call_it); }
214 };
215
216 /** Abstracts functor execution.
217  * call_it() invokes a functor of type @e T_functor with a list of
218  * parameters whose types are given by the template arguments.
219  * address() forms a function pointer from call_it().
220  *
221  * The following template arguments are used:
222  * - @e T_functor The functor type.
223  * - @e T_return The return type of call_it().
224  * - @e T_arg1 Argument type used in the definition of call_it().
225  * - @e T_arg2 Argument type used in the definition of call_it().
226  * - @e T_arg3 Argument type used in the definition of call_it().
227  *
228  */
229 template<class T_functor, class T_return, class T_arg1, class T_arg2, class T_arg3>
230 struct slot_call3
231 {
232   /** Invokes a functor of type @p T_functor.
233    * @param rep slot_rep object that holds a functor of type @p T_functor.
234    * @param _A_a1 Argument to be passed on to the functor.
235    * @param _A_a2 Argument to be passed on to the functor.
236    * @param _A_a3 Argument to be passed on to the functor.
237    * @return The return values of the functor invocation.
238    */
239   static T_return call_it(slot_rep* rep, type_trait_take_t<T_arg1> a_1, type_trait_take_t<T_arg2> a_2, type_trait_take_t<T_arg3> a_3)
240     {
241       typedef typed_slot_rep<T_functor> typed_slot;
242       typed_slot *typed_rep = static_cast<typed_slot*>(rep);
243       return (typed_rep->functor_).SIGC_WORKAROUND_OPERATOR_PARENTHESES<type_trait_take_t<T_arg1>, type_trait_take_t<T_arg2>, type_trait_take_t<T_arg3>>
244                (a_1, a_2, a_3);
245     }
246
247   /** Forms a function pointer from call_it().
248    * @return A function pointer formed from call_it().
249    */
250   static hook address()
251   { return sigc::internal::function_pointer_cast<hook>(&call_it); }
252 };
253
254 /** Abstracts functor execution.
255  * call_it() invokes a functor of type @e T_functor with a list of
256  * parameters whose types are given by the template arguments.
257  * address() forms a function pointer from call_it().
258  *
259  * The following template arguments are used:
260  * - @e T_functor The functor type.
261  * - @e T_return The return type of call_it().
262  * - @e T_arg1 Argument type used in the definition of call_it().
263  * - @e T_arg2 Argument type used in the definition of call_it().
264  * - @e T_arg3 Argument type used in the definition of call_it().
265  * - @e T_arg4 Argument type used in the definition of call_it().
266  *
267  */
268 template<class T_functor, class T_return, class T_arg1, class T_arg2, class T_arg3, class T_arg4>
269 struct slot_call4
270 {
271   /** Invokes a functor of type @p T_functor.
272    * @param rep slot_rep object that holds a functor of type @p T_functor.
273    * @param _A_a1 Argument to be passed on to the functor.
274    * @param _A_a2 Argument to be passed on to the functor.
275    * @param _A_a3 Argument to be passed on to the functor.
276    * @param _A_a4 Argument to be passed on to the functor.
277    * @return The return values of the functor invocation.
278    */
279   static T_return call_it(slot_rep* rep, type_trait_take_t<T_arg1> a_1, type_trait_take_t<T_arg2> a_2, type_trait_take_t<T_arg3> a_3, type_trait_take_t<T_arg4> a_4)
280     {
281       typedef typed_slot_rep<T_functor> typed_slot;
282       typed_slot *typed_rep = static_cast<typed_slot*>(rep);
283       return (typed_rep->functor_).SIGC_WORKAROUND_OPERATOR_PARENTHESES<type_trait_take_t<T_arg1>, type_trait_take_t<T_arg2>, type_trait_take_t<T_arg3>, type_trait_take_t<T_arg4>>
284                (a_1, a_2, a_3, a_4);
285     }
286
287   /** Forms a function pointer from call_it().
288    * @return A function pointer formed from call_it().
289    */
290   static hook address()
291   { return sigc::internal::function_pointer_cast<hook>(&call_it); }
292 };
293
294 /** Abstracts functor execution.
295  * call_it() invokes a functor of type @e T_functor with a list of
296  * parameters whose types are given by the template arguments.
297  * address() forms a function pointer from call_it().
298  *
299  * The following template arguments are used:
300  * - @e T_functor The functor type.
301  * - @e T_return The return type of call_it().
302  * - @e T_arg1 Argument type used in the definition of call_it().
303  * - @e T_arg2 Argument type used in the definition of call_it().
304  * - @e T_arg3 Argument type used in the definition of call_it().
305  * - @e T_arg4 Argument type used in the definition of call_it().
306  * - @e T_arg5 Argument type used in the definition of call_it().
307  *
308  */
309 template<class T_functor, class T_return, class T_arg1, class T_arg2, class T_arg3, class T_arg4, class T_arg5>
310 struct slot_call5
311 {
312   /** Invokes a functor of type @p T_functor.
313    * @param rep slot_rep object that holds a functor of type @p T_functor.
314    * @param _A_a1 Argument to be passed on to the functor.
315    * @param _A_a2 Argument to be passed on to the functor.
316    * @param _A_a3 Argument to be passed on to the functor.
317    * @param _A_a4 Argument to be passed on to the functor.
318    * @param _A_a5 Argument to be passed on to the functor.
319    * @return The return values of the functor invocation.
320    */
321   static T_return call_it(slot_rep* rep, type_trait_take_t<T_arg1> a_1, type_trait_take_t<T_arg2> a_2, type_trait_take_t<T_arg3> a_3, type_trait_take_t<T_arg4> a_4, type_trait_take_t<T_arg5> a_5)
322     {
323       typedef typed_slot_rep<T_functor> typed_slot;
324       typed_slot *typed_rep = static_cast<typed_slot*>(rep);
325       return (typed_rep->functor_).SIGC_WORKAROUND_OPERATOR_PARENTHESES<type_trait_take_t<T_arg1>, type_trait_take_t<T_arg2>, type_trait_take_t<T_arg3>, type_trait_take_t<T_arg4>, type_trait_take_t<T_arg5>>
326                (a_1, a_2, a_3, a_4, a_5);
327     }
328
329   /** Forms a function pointer from call_it().
330    * @return A function pointer formed from call_it().
331    */
332   static hook address()
333   { return sigc::internal::function_pointer_cast<hook>(&call_it); }
334 };
335
336 /** Abstracts functor execution.
337  * call_it() invokes a functor of type @e T_functor with a list of
338  * parameters whose types are given by the template arguments.
339  * address() forms a function pointer from call_it().
340  *
341  * The following template arguments are used:
342  * - @e T_functor The functor type.
343  * - @e T_return The return type of call_it().
344  * - @e T_arg1 Argument type used in the definition of call_it().
345  * - @e T_arg2 Argument type used in the definition of call_it().
346  * - @e T_arg3 Argument type used in the definition of call_it().
347  * - @e T_arg4 Argument type used in the definition of call_it().
348  * - @e T_arg5 Argument type used in the definition of call_it().
349  * - @e T_arg6 Argument type used in the definition of call_it().
350  *
351  */
352 template<class T_functor, class T_return, class T_arg1, class T_arg2, class T_arg3, class T_arg4, class T_arg5, class T_arg6>
353 struct slot_call6
354 {
355   /** Invokes a functor of type @p T_functor.
356    * @param rep slot_rep object that holds a functor of type @p T_functor.
357    * @param _A_a1 Argument to be passed on to the functor.
358    * @param _A_a2 Argument to be passed on to the functor.
359    * @param _A_a3 Argument to be passed on to the functor.
360    * @param _A_a4 Argument to be passed on to the functor.
361    * @param _A_a5 Argument to be passed on to the functor.
362    * @param _A_a6 Argument to be passed on to the functor.
363    * @return The return values of the functor invocation.
364    */
365   static T_return call_it(slot_rep* rep, type_trait_take_t<T_arg1> a_1, type_trait_take_t<T_arg2> a_2, type_trait_take_t<T_arg3> a_3, type_trait_take_t<T_arg4> a_4, type_trait_take_t<T_arg5> a_5, type_trait_take_t<T_arg6> a_6)
366     {
367       typedef typed_slot_rep<T_functor> typed_slot;
368       typed_slot *typed_rep = static_cast<typed_slot*>(rep);
369       return (typed_rep->functor_).SIGC_WORKAROUND_OPERATOR_PARENTHESES<type_trait_take_t<T_arg1>, type_trait_take_t<T_arg2>, type_trait_take_t<T_arg3>, type_trait_take_t<T_arg4>, type_trait_take_t<T_arg5>, type_trait_take_t<T_arg6>>
370                (a_1, a_2, a_3, a_4, a_5, a_6);
371     }
372
373   /** Forms a function pointer from call_it().
374    * @return A function pointer formed from call_it().
375    */
376   static hook address()
377   { return sigc::internal::function_pointer_cast<hook>(&call_it); }
378 };
379
380 /** Abstracts functor execution.
381  * call_it() invokes a functor of type @e T_functor with a list of
382  * parameters whose types are given by the template arguments.
383  * address() forms a function pointer from call_it().
384  *
385  * The following template arguments are used:
386  * - @e T_functor The functor type.
387  * - @e T_return The return type of call_it().
388  * - @e T_arg1 Argument type used in the definition of call_it().
389  * - @e T_arg2 Argument type used in the definition of call_it().
390  * - @e T_arg3 Argument type used in the definition of call_it().
391  * - @e T_arg4 Argument type used in the definition of call_it().
392  * - @e T_arg5 Argument type used in the definition of call_it().
393  * - @e T_arg6 Argument type used in the definition of call_it().
394  * - @e T_arg7 Argument type used in the definition of call_it().
395  *
396  */
397 template<class T_functor, class T_return, class T_arg1, class T_arg2, class T_arg3, class T_arg4, class T_arg5, class T_arg6, class T_arg7>
398 struct slot_call7
399 {
400   /** Invokes a functor of type @p T_functor.
401    * @param rep slot_rep object that holds a functor of type @p T_functor.
402    * @param _A_a1 Argument to be passed on to the functor.
403    * @param _A_a2 Argument to be passed on to the functor.
404    * @param _A_a3 Argument to be passed on to the functor.
405    * @param _A_a4 Argument to be passed on to the functor.
406    * @param _A_a5 Argument to be passed on to the functor.
407    * @param _A_a6 Argument to be passed on to the functor.
408    * @param _A_a7 Argument to be passed on to the functor.
409    * @return The return values of the functor invocation.
410    */
411   static T_return call_it(slot_rep* rep, type_trait_take_t<T_arg1> a_1, type_trait_take_t<T_arg2> a_2, type_trait_take_t<T_arg3> a_3, type_trait_take_t<T_arg4> a_4, type_trait_take_t<T_arg5> a_5, type_trait_take_t<T_arg6> a_6, type_trait_take_t<T_arg7> a_7)
412     {
413       typedef typed_slot_rep<T_functor> typed_slot;
414       typed_slot *typed_rep = static_cast<typed_slot*>(rep);
415       return (typed_rep->functor_).SIGC_WORKAROUND_OPERATOR_PARENTHESES<type_trait_take_t<T_arg1>, type_trait_take_t<T_arg2>, type_trait_take_t<T_arg3>, type_trait_take_t<T_arg4>, type_trait_take_t<T_arg5>, type_trait_take_t<T_arg6>, type_trait_take_t<T_arg7>>
416                (a_1, a_2, a_3, a_4, a_5, a_6, a_7);
417     }
418
419   /** Forms a function pointer from call_it().
420    * @return A function pointer formed from call_it().
421    */
422   static hook address()
423   { return sigc::internal::function_pointer_cast<hook>(&call_it); }
424 };
425
426
427 /** Abstracts functor execution.
428  * call_it() invokes a functor of type @e T_functor with a list of
429  * parameters whose types are given by the template arguments.
430  * address() forms a function pointer from call_it().
431  *
432  * The following template arguments are used:
433  * - @e T_functor The functor type.
434  * - @e T_return The return type of call_it().
435  * - @e T_arg Argument types used in the definition of call_it().
436  *
437  */
438 template<class T_functor, class T_return, class... T_arg>
439 struct slot_call
440 {
441   /** Invokes a functor of type @p T_functor.
442    * @param rep slot_rep object that holds a functor of type @p T_functor.
443    * @param _A_a Arguments to be passed on to the functor.
444    * @return The return values of the functor invocation.
445    */
446   static T_return call_it(slot_rep* rep, type_trait_take_t<T_arg>... a_)
447     {
448       using typed_slot = typed_slot_rep<T_functor>;
449       typed_slot *typed_rep = static_cast<typed_slot*>(rep);
450       return (typed_rep->functor_).SIGC_WORKAROUND_OPERATOR_PARENTHESES<type_trait_take_t<T_arg>...>
451                (a_...);
452     }
453
454   /** Forms a function pointer from call_it().
455    * @return A function pointer formed from call_it().
456    */
457   static hook address()
458   { return sigc::internal::function_pointer_cast<hook>(&call_it); }
459 };
460
461 /** Abstracts functor execution.
462  * call_it() invokes a functor without parameters of type @e T_functor.
463  * address() forms a function pointer from call_it().
464  *
465  * This is a specialization for functors without parameters.
466  *
467  * The following template arguments are used:
468  * - @e T_functor The functor type.
469  * - @e T_return The return type of call_it().
470  *
471  */
472 template<class T_functor, class T_return>
473 struct slot_call<T_functor, T_return>
474 {
475   /** Invokes a functor of type @p T_functor.
476    * @param rep slot_rep object that holds a functor of type @p T_functor.
477    * @return The return values of the functor invocation.
478    */
479   static T_return call_it(slot_rep* rep)
480     {
481       using typed_slot = typed_slot_rep<T_functor>;
482       typed_slot *typed_rep = static_cast<typed_slot*>(rep);
483       return (typed_rep->functor_)();
484     }
485
486   /** Forms a function pointer from call_it().
487    * @return A function pointer formed from call_it().
488    */
489   static hook address()
490   { return sigc::internal::function_pointer_cast<hook>(&call_it); }
491 };
492
493 } /* namespace internal */
494
495
496 /** Converts an arbitrary functor to a unified type which is opaque.
497  * sigc::slot itself is a functor or to be more precise a closure. It contains
498  * a single, arbitrary functor (or closure) that is executed in operator()().
499  *
500  * The template arguments determine the function signature of operator()():
501  * - @e T_return The return type of operator()().
502  *
503  * To use simply assign the desired functor to the slot. If the functor
504  * is not compatible with the parameter list defined with the template
505  * arguments compiler errors are triggered. When called the slot
506  * will invoke the functor with minimal copies.
507  * block() and unblock() can be used to block the functor's invocation
508  * from operator()() temporarily.
509  *
510  * You should use the more convenient unnumbered sigc::slot template.
511  *
512  * @ingroup slot
513  */
514 template <class T_return>
515 class slot0
516   : public slot_base
517 {
518 public:
519   typedef T_return result_type;
520
521
522 #ifndef DOXYGEN_SHOULD_SKIP_THIS
523 private:
524   typedef internal::slot_rep rep_type;
525 public:
526   typedef T_return (*call_type)(rep_type*);
527 #endif
528
529   /** Invoke the contained functor unless slot is in blocking state.
530    * @return The return value of the functor invocation.
531    */
532   inline T_return operator()() const
533     {
534       if (!empty() && !blocked())
535         return (sigc::internal::function_pointer_cast<call_type>(slot_base::rep_->call_))(slot_base::rep_);
536       return T_return();
537     }
538
539   inline slot0() {}
540
541   /** Constructs a slot from an arbitrary functor.
542    * @param _A_func The desired functor the new slot should be assigned to.
543    */
544   template <class T_functor>
545   slot0(const T_functor& _A_func)
546     : slot_base(new internal::typed_slot_rep<T_functor>(_A_func))
547     {
548       //The slot_base:: is necessary to stop the HP-UX aCC compiler from being confused. murrayc.
549       slot_base::rep_->call_ = internal::slot_call0<T_functor, T_return>::address();
550     }
551
552   /** Constructs a slot, copying an existing one.
553    * @param src The existing slot to copy.
554    */
555   slot0(const slot0& src)
556     : slot_base(src)
557     {}
558
559   /** Constructs a slot, moving an existing one.
560    * If @p src is connected to a parent (e.g. a signal), it is copied, not moved.
561    * @param src The existing slot to move or copy.
562    */
563   slot0(slot0&& src)
564     : slot_base(std::move(src))
565     {}
566
567   /** Overrides this slot, making a copy from another slot.
568    * @param src The slot from which to make a copy.
569    * @return @p this.
570    */
571   slot0& operator=(const slot0& src)
572   {
573     slot_base::operator=(src);
574     return *this;
575   }
576
577   /** Overrides this slot, making a move from another slot.
578    * If @p src is connected to a parent (e.g. a signal), it is copied, not moved.
579    * @param src The slot from which to move or copy.
580    * @return @p this.
581    */
582   slot0& operator=(slot0&& src)
583   {
584     slot_base::operator=(std::move(src));
585     return *this;
586   }
587 };
588
589 #ifndef DOXYGEN_SHOULD_SKIP_THIS
590 //template specialization of visitor<>::do_visit_each<>(action, functor):
591 /** Performs a functor on each of the targets of a functor.
592  * The function overloads for sigc::slot0 are similar to the function
593  * overloads for sigc::slot. See the description of those overloads.
594  *
595  * @ingroup slot
596  */
597 template <typename T_return>
598 struct visitor<slot0<T_return>>
599 {
600   static void do_visit_each(const internal::limit_derived_target<trackable*, internal::slot_do_bind>& _A_action,
601                             const slot0<T_return>& _A_target)
602   {
603     if (_A_target.rep_ && _A_target.rep_->parent_ == nullptr)
604     _A_target.rep_->set_parent(_A_action.action_.rep_, &internal::slot_rep::notify);
605   }
606
607   static void do_visit_each(const internal::limit_derived_target<trackable*, internal::slot_do_unbind>& _A_action,
608                             const slot0<T_return>& _A_target)
609   {
610     if (_A_target.rep_ && _A_target.rep_->parent_ == _A_action.action_.rep_)
611       _A_target.rep_->set_parent(nullptr, nullptr);
612   }
613
614   template <typename T_action>
615   static void do_visit_each(const T_action& _A_action,
616                             const slot0<T_return>& _A_target)
617   {
618     _A_action(_A_target);
619   }
620 };
621 #endif // DOXYGEN_SHOULD_SKIP_THIS
622
623 /** Converts an arbitrary functor to a unified type which is opaque.
624  * sigc::slot itself is a functor or to be more precise a closure. It contains
625  * a single, arbitrary functor (or closure) that is executed in operator()().
626  *
627  * The template arguments determine the function signature of operator()():
628  * - @e T_return The return type of operator()().
629  * - @e T_arg1 Argument type used in the definition of operator()(). The default @p nil means no argument.
630  *
631  * To use simply assign the desired functor to the slot. If the functor
632  * is not compatible with the parameter list defined with the template
633  * arguments compiler errors are triggered. When called the slot
634  * will invoke the functor with minimal copies.
635  * block() and unblock() can be used to block the functor's invocation
636  * from operator()() temporarily.
637  *
638  * You should use the more convenient unnumbered sigc::slot template.
639  *
640  * @ingroup slot
641  */
642 template <class T_return, class T_arg1>
643 class slot1
644   : public slot_base
645 {
646 public:
647   typedef T_return result_type;
648   typedef type_trait_take_t<T_arg1> arg1_type_;
649
650
651 #ifndef DOXYGEN_SHOULD_SKIP_THIS
652 private:
653   typedef internal::slot_rep rep_type;
654 public:
655   typedef T_return (*call_type)(rep_type*, arg1_type_);
656 #endif
657
658   /** Invoke the contained functor unless slot is in blocking state.
659    * @param _A_a1 Argument to be passed on to the functor.
660    * @return The return value of the functor invocation.
661    */
662   inline T_return operator()(arg1_type_ _A_a1) const
663     {
664       if (!empty() && !blocked())
665         return (sigc::internal::function_pointer_cast<call_type>(slot_base::rep_->call_))(slot_base::rep_, _A_a1);
666       return T_return();
667     }
668
669   inline slot1() {}
670
671   /** Constructs a slot from an arbitrary functor.
672    * @param _A_func The desired functor the new slot should be assigned to.
673    */
674   template <class T_functor>
675   slot1(const T_functor& _A_func)
676     : slot_base(new internal::typed_slot_rep<T_functor>(_A_func))
677     {
678       //The slot_base:: is necessary to stop the HP-UX aCC compiler from being confused. murrayc.
679       slot_base::rep_->call_ = internal::slot_call1<T_functor, T_return, T_arg1>::address();
680     }
681
682   /** Constructs a slot, copying an existing one.
683    * @param src The existing slot to copy.
684    */
685   slot1(const slot1& src)
686     : slot_base(src)
687     {}
688
689   /** Constructs a slot, moving an existing one.
690    * If @p src is connected to a parent (e.g. a signal), it is copied, not moved.
691    * @param src The existing slot to move or copy.
692    */
693   slot1(slot1&& src)
694     : slot_base(std::move(src))
695     {}
696
697   /** Overrides this slot, making a copy from another slot.
698    * @param src The slot from which to make a copy.
699    * @return @p this.
700    */
701   slot1& operator=(const slot1& src)
702   {
703     slot_base::operator=(src);
704     return *this;
705   }
706
707   /** Overrides this slot, making a move from another slot.
708    * If @p src is connected to a parent (e.g. a signal), it is copied, not moved.
709    * @param src The slot from which to move or copy.
710    * @return @p this.
711    */
712   slot1& operator=(slot1&& src)
713   {
714     slot_base::operator=(std::move(src));
715     return *this;
716   }
717 };
718
719 #ifndef DOXYGEN_SHOULD_SKIP_THIS
720 //template specialization of visitor<>::do_visit_each<>(action, functor):
721 /** Performs a functor on each of the targets of a functor.
722  * The function overloads for sigc::slot1 are similar to the function
723  * overloads for sigc::slot. See the description of those overloads.
724  *
725  * @ingroup slot
726  */
727 template <typename T_return, typename T_arg1>
728 struct visitor<slot1<T_return, T_arg1>>
729 {
730   static void do_visit_each(const internal::limit_derived_target<trackable*, internal::slot_do_bind>& _A_action,
731                             const slot1<T_return, T_arg1>& _A_target)
732   {
733     if (_A_target.rep_ && _A_target.rep_->parent_ == nullptr)
734     _A_target.rep_->set_parent(_A_action.action_.rep_, &internal::slot_rep::notify);
735   }
736
737   static void do_visit_each(const internal::limit_derived_target<trackable*, internal::slot_do_unbind>& _A_action,
738                             const slot1<T_return, T_arg1>& _A_target)
739   {
740     if (_A_target.rep_ && _A_target.rep_->parent_ == _A_action.action_.rep_)
741       _A_target.rep_->set_parent(nullptr, nullptr);
742   }
743
744   template <typename T_action>
745   static void do_visit_each(const T_action& _A_action,
746                             const slot1<T_return, T_arg1>& _A_target)
747   {
748     _A_action(_A_target);
749   }
750 };
751 #endif // DOXYGEN_SHOULD_SKIP_THIS
752
753 /** Converts an arbitrary functor to a unified type which is opaque.
754  * sigc::slot itself is a functor or to be more precise a closure. It contains
755  * a single, arbitrary functor (or closure) that is executed in operator()().
756  *
757  * The template arguments determine the function signature of operator()():
758  * - @e T_return The return type of operator()().
759  * - @e T_arg1 Argument type used in the definition of operator()(). The default @p nil means no argument.
760  * - @e T_arg2 Argument type used in the definition of operator()(). The default @p nil means no argument.
761  *
762  * To use simply assign the desired functor to the slot. If the functor
763  * is not compatible with the parameter list defined with the template
764  * arguments compiler errors are triggered. When called the slot
765  * will invoke the functor with minimal copies.
766  * block() and unblock() can be used to block the functor's invocation
767  * from operator()() temporarily.
768  *
769  * You should use the more convenient unnumbered sigc::slot template.
770  *
771  * @ingroup slot
772  */
773 template <class T_return, class T_arg1, class T_arg2>
774 class slot2
775   : public slot_base
776 {
777 public:
778   typedef T_return result_type;
779   typedef type_trait_take_t<T_arg1> arg1_type_;
780   typedef type_trait_take_t<T_arg2> arg2_type_;
781
782
783 #ifndef DOXYGEN_SHOULD_SKIP_THIS
784 private:
785   typedef internal::slot_rep rep_type;
786 public:
787   typedef T_return (*call_type)(rep_type*, arg1_type_, arg2_type_);
788 #endif
789
790   /** Invoke the contained functor unless slot is in blocking state.
791    * @param _A_a1 Argument to be passed on to the functor.
792    * @param _A_a2 Argument to be passed on to the functor.
793    * @return The return value of the functor invocation.
794    */
795   inline T_return operator()(arg1_type_ _A_a1, arg2_type_ _A_a2) const
796     {
797       if (!empty() && !blocked())
798         return (sigc::internal::function_pointer_cast<call_type>(slot_base::rep_->call_))(slot_base::rep_, _A_a1, _A_a2);
799       return T_return();
800     }
801
802   inline slot2() {}
803
804   /** Constructs a slot from an arbitrary functor.
805    * @param _A_func The desired functor the new slot should be assigned to.
806    */
807   template <class T_functor>
808   slot2(const T_functor& _A_func)
809     : slot_base(new internal::typed_slot_rep<T_functor>(_A_func))
810     {
811       //The slot_base:: is necessary to stop the HP-UX aCC compiler from being confused. murrayc.
812       slot_base::rep_->call_ = internal::slot_call2<T_functor, T_return, T_arg1, T_arg2>::address();
813     }
814
815   /** Constructs a slot, copying an existing one.
816    * @param src The existing slot to copy.
817    */
818   slot2(const slot2& src)
819     : slot_base(src)
820     {}
821
822   /** Constructs a slot, moving an existing one.
823    * If @p src is connected to a parent (e.g. a signal), it is copied, not moved.
824    * @param src The existing slot to move or copy.
825    */
826   slot2(slot2&& src)
827     : slot_base(std::move(src))
828     {}
829
830   /** Overrides this slot, making a copy from another slot.
831    * @param src The slot from which to make a copy.
832    * @return @p this.
833    */
834   slot2& operator=(const slot2& src)
835   {
836     slot_base::operator=(src);
837     return *this;
838   }
839
840   /** Overrides this slot, making a move from another slot.
841    * If @p src is connected to a parent (e.g. a signal), it is copied, not moved.
842    * @param src The slot from which to move or copy.
843    * @return @p this.
844    */
845   slot2& operator=(slot2&& src)
846   {
847     slot_base::operator=(std::move(src));
848     return *this;
849   }
850 };
851
852 #ifndef DOXYGEN_SHOULD_SKIP_THIS
853 //template specialization of visitor<>::do_visit_each<>(action, functor):
854 /** Performs a functor on each of the targets of a functor.
855  * The function overloads for sigc::slot2 are similar to the function
856  * overloads for sigc::slot. See the description of those overloads.
857  *
858  * @ingroup slot
859  */
860 template <typename T_return, typename T_arg1, typename T_arg2>
861 struct visitor<slot2<T_return, T_arg1, T_arg2>>
862 {
863   static void do_visit_each(const internal::limit_derived_target<trackable*, internal::slot_do_bind>& _A_action,
864                             const slot2<T_return, T_arg1, T_arg2>& _A_target)
865   {
866     if (_A_target.rep_ && _A_target.rep_->parent_ == nullptr)
867     _A_target.rep_->set_parent(_A_action.action_.rep_, &internal::slot_rep::notify);
868   }
869
870   static void do_visit_each(const internal::limit_derived_target<trackable*, internal::slot_do_unbind>& _A_action,
871                             const slot2<T_return, T_arg1, T_arg2>& _A_target)
872   {
873     if (_A_target.rep_ && _A_target.rep_->parent_ == _A_action.action_.rep_)
874       _A_target.rep_->set_parent(nullptr, nullptr);
875   }
876
877   template <typename T_action>
878   static void do_visit_each(const T_action& _A_action,
879                             const slot2<T_return, T_arg1, T_arg2>& _A_target)
880   {
881     _A_action(_A_target);
882   }
883 };
884 #endif // DOXYGEN_SHOULD_SKIP_THIS
885
886 /** Converts an arbitrary functor to a unified type which is opaque.
887  * sigc::slot itself is a functor or to be more precise a closure. It contains
888  * a single, arbitrary functor (or closure) that is executed in operator()().
889  *
890  * The template arguments determine the function signature of operator()():
891  * - @e T_return The return type of operator()().
892  * - @e T_arg1 Argument type used in the definition of operator()(). The default @p nil means no argument.
893  * - @e T_arg2 Argument type used in the definition of operator()(). The default @p nil means no argument.
894  * - @e T_arg3 Argument type used in the definition of operator()(). The default @p nil means no argument.
895  *
896  * To use simply assign the desired functor to the slot. If the functor
897  * is not compatible with the parameter list defined with the template
898  * arguments compiler errors are triggered. When called the slot
899  * will invoke the functor with minimal copies.
900  * block() and unblock() can be used to block the functor's invocation
901  * from operator()() temporarily.
902  *
903  * You should use the more convenient unnumbered sigc::slot template.
904  *
905  * @ingroup slot
906  */
907 template <class T_return, class T_arg1, class T_arg2, class T_arg3>
908 class slot3
909   : public slot_base
910 {
911 public:
912   typedef T_return result_type;
913   typedef type_trait_take_t<T_arg1> arg1_type_;
914   typedef type_trait_take_t<T_arg2> arg2_type_;
915   typedef type_trait_take_t<T_arg3> arg3_type_;
916
917
918 #ifndef DOXYGEN_SHOULD_SKIP_THIS
919 private:
920   typedef internal::slot_rep rep_type;
921 public:
922   typedef T_return (*call_type)(rep_type*, arg1_type_, arg2_type_, arg3_type_);
923 #endif
924
925   /** Invoke the contained functor unless slot is in blocking state.
926    * @param _A_a1 Argument to be passed on to the functor.
927    * @param _A_a2 Argument to be passed on to the functor.
928    * @param _A_a3 Argument to be passed on to the functor.
929    * @return The return value of the functor invocation.
930    */
931   inline T_return operator()(arg1_type_ _A_a1, arg2_type_ _A_a2, arg3_type_ _A_a3) const
932     {
933       if (!empty() && !blocked())
934         return (sigc::internal::function_pointer_cast<call_type>(slot_base::rep_->call_))(slot_base::rep_, _A_a1, _A_a2, _A_a3);
935       return T_return();
936     }
937
938   inline slot3() {}
939
940   /** Constructs a slot from an arbitrary functor.
941    * @param _A_func The desired functor the new slot should be assigned to.
942    */
943   template <class T_functor>
944   slot3(const T_functor& _A_func)
945     : slot_base(new internal::typed_slot_rep<T_functor>(_A_func))
946     {
947       //The slot_base:: is necessary to stop the HP-UX aCC compiler from being confused. murrayc.
948       slot_base::rep_->call_ = internal::slot_call3<T_functor, T_return, T_arg1, T_arg2, T_arg3>::address();
949     }
950
951   /** Constructs a slot, copying an existing one.
952    * @param src The existing slot to copy.
953    */
954   slot3(const slot3& src)
955     : slot_base(src)
956     {}
957
958   /** Constructs a slot, moving an existing one.
959    * If @p src is connected to a parent (e.g. a signal), it is copied, not moved.
960    * @param src The existing slot to move or copy.
961    */
962   slot3(slot3&& src)
963     : slot_base(std::move(src))
964     {}
965
966   /** Overrides this slot, making a copy from another slot.
967    * @param src The slot from which to make a copy.
968    * @return @p this.
969    */
970   slot3& operator=(const slot3& src)
971   {
972     slot_base::operator=(src);
973     return *this;
974   }
975
976   /** Overrides this slot, making a move from another slot.
977    * If @p src is connected to a parent (e.g. a signal), it is copied, not moved.
978    * @param src The slot from which to move or copy.
979    * @return @p this.
980    */
981   slot3& operator=(slot3&& src)
982   {
983     slot_base::operator=(std::move(src));
984     return *this;
985   }
986 };
987
988 #ifndef DOXYGEN_SHOULD_SKIP_THIS
989 //template specialization of visitor<>::do_visit_each<>(action, functor):
990 /** Performs a functor on each of the targets of a functor.
991  * The function overloads for sigc::slot3 are similar to the function
992  * overloads for sigc::slot. See the description of those overloads.
993  *
994  * @ingroup slot
995  */
996 template <typename T_return, typename T_arg1, typename T_arg2, typename T_arg3>
997 struct visitor<slot3<T_return, T_arg1, T_arg2, T_arg3>>
998 {
999   static void do_visit_each(const internal::limit_derived_target<trackable*, internal::slot_do_bind>& _A_action,
1000                             const slot3<T_return, T_arg1, T_arg2, T_arg3>& _A_target)
1001   {
1002     if (_A_target.rep_ && _A_target.rep_->parent_ == nullptr)
1003     _A_target.rep_->set_parent(_A_action.action_.rep_, &internal::slot_rep::notify);
1004   }
1005
1006   static void do_visit_each(const internal::limit_derived_target<trackable*, internal::slot_do_unbind>& _A_action,
1007                             const slot3<T_return, T_arg1, T_arg2, T_arg3>& _A_target)
1008   {
1009     if (_A_target.rep_ && _A_target.rep_->parent_ == _A_action.action_.rep_)
1010       _A_target.rep_->set_parent(nullptr, nullptr);
1011   }
1012
1013   template <typename T_action>
1014   static void do_visit_each(const T_action& _A_action,
1015                             const slot3<T_return, T_arg1, T_arg2, T_arg3>& _A_target)
1016   {
1017     _A_action(_A_target);
1018   }
1019 };
1020 #endif // DOXYGEN_SHOULD_SKIP_THIS
1021
1022 /** Converts an arbitrary functor to a unified type which is opaque.
1023  * sigc::slot itself is a functor or to be more precise a closure. It contains
1024  * a single, arbitrary functor (or closure) that is executed in operator()().
1025  *
1026  * The template arguments determine the function signature of operator()():
1027  * - @e T_return The return type of operator()().
1028  * - @e T_arg1 Argument type used in the definition of operator()(). The default @p nil means no argument.
1029  * - @e T_arg2 Argument type used in the definition of operator()(). The default @p nil means no argument.
1030  * - @e T_arg3 Argument type used in the definition of operator()(). The default @p nil means no argument.
1031  * - @e T_arg4 Argument type used in the definition of operator()(). The default @p nil means no argument.
1032  *
1033  * To use simply assign the desired functor to the slot. If the functor
1034  * is not compatible with the parameter list defined with the template
1035  * arguments compiler errors are triggered. When called the slot
1036  * will invoke the functor with minimal copies.
1037  * block() and unblock() can be used to block the functor's invocation
1038  * from operator()() temporarily.
1039  *
1040  * You should use the more convenient unnumbered sigc::slot template.
1041  *
1042  * @ingroup slot
1043  */
1044 template <class T_return, class T_arg1, class T_arg2, class T_arg3, class T_arg4>
1045 class slot4
1046   : public slot_base
1047 {
1048 public:
1049   typedef T_return result_type;
1050   typedef type_trait_take_t<T_arg1> arg1_type_;
1051   typedef type_trait_take_t<T_arg2> arg2_type_;
1052   typedef type_trait_take_t<T_arg3> arg3_type_;
1053   typedef type_trait_take_t<T_arg4> arg4_type_;
1054
1055
1056 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1057 private:
1058   typedef internal::slot_rep rep_type;
1059 public:
1060   typedef T_return (*call_type)(rep_type*, arg1_type_, arg2_type_, arg3_type_, arg4_type_);
1061 #endif
1062
1063   /** Invoke the contained functor unless slot is in blocking state.
1064    * @param _A_a1 Argument to be passed on to the functor.
1065    * @param _A_a2 Argument to be passed on to the functor.
1066    * @param _A_a3 Argument to be passed on to the functor.
1067    * @param _A_a4 Argument to be passed on to the functor.
1068    * @return The return value of the functor invocation.
1069    */
1070   inline T_return operator()(arg1_type_ _A_a1, arg2_type_ _A_a2, arg3_type_ _A_a3, arg4_type_ _A_a4) const
1071     {
1072       if (!empty() && !blocked())
1073         return (sigc::internal::function_pointer_cast<call_type>(slot_base::rep_->call_))(slot_base::rep_, _A_a1, _A_a2, _A_a3, _A_a4);
1074       return T_return();
1075     }
1076
1077   inline slot4() {}
1078
1079   /** Constructs a slot from an arbitrary functor.
1080    * @param _A_func The desired functor the new slot should be assigned to.
1081    */
1082   template <class T_functor>
1083   slot4(const T_functor& _A_func)
1084     : slot_base(new internal::typed_slot_rep<T_functor>(_A_func))
1085     {
1086       //The slot_base:: is necessary to stop the HP-UX aCC compiler from being confused. murrayc.
1087       slot_base::rep_->call_ = internal::slot_call4<T_functor, T_return, T_arg1, T_arg2, T_arg3, T_arg4>::address();
1088     }
1089
1090   /** Constructs a slot, copying an existing one.
1091    * @param src The existing slot to copy.
1092    */
1093   slot4(const slot4& src)
1094     : slot_base(src)
1095     {}
1096
1097   /** Constructs a slot, moving an existing one.
1098    * If @p src is connected to a parent (e.g. a signal), it is copied, not moved.
1099    * @param src The existing slot to move or copy.
1100    */
1101   slot4(slot4&& src)
1102     : slot_base(std::move(src))
1103     {}
1104
1105   /** Overrides this slot, making a copy from another slot.
1106    * @param src The slot from which to make a copy.
1107    * @return @p this.
1108    */
1109   slot4& operator=(const slot4& src)
1110   {
1111     slot_base::operator=(src);
1112     return *this;
1113   }
1114
1115   /** Overrides this slot, making a move from another slot.
1116    * If @p src is connected to a parent (e.g. a signal), it is copied, not moved.
1117    * @param src The slot from which to move or copy.
1118    * @return @p this.
1119    */
1120   slot4& operator=(slot4&& src)
1121   {
1122     slot_base::operator=(std::move(src));
1123     return *this;
1124   }
1125 };
1126
1127 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1128 //template specialization of visitor<>::do_visit_each<>(action, functor):
1129 /** Performs a functor on each of the targets of a functor.
1130  * The function overloads for sigc::slot4 are similar to the function
1131  * overloads for sigc::slot. See the description of those overloads.
1132  *
1133  * @ingroup slot
1134  */
1135 template <typename T_return, typename T_arg1, typename T_arg2, typename T_arg3, typename T_arg4>
1136 struct visitor<slot4<T_return, T_arg1, T_arg2, T_arg3, T_arg4>>
1137 {
1138   static void do_visit_each(const internal::limit_derived_target<trackable*, internal::slot_do_bind>& _A_action,
1139                             const slot4<T_return, T_arg1, T_arg2, T_arg3, T_arg4>& _A_target)
1140   {
1141     if (_A_target.rep_ && _A_target.rep_->parent_ == nullptr)
1142     _A_target.rep_->set_parent(_A_action.action_.rep_, &internal::slot_rep::notify);
1143   }
1144
1145   static void do_visit_each(const internal::limit_derived_target<trackable*, internal::slot_do_unbind>& _A_action,
1146                             const slot4<T_return, T_arg1, T_arg2, T_arg3, T_arg4>& _A_target)
1147   {
1148     if (_A_target.rep_ && _A_target.rep_->parent_ == _A_action.action_.rep_)
1149       _A_target.rep_->set_parent(nullptr, nullptr);
1150   }
1151
1152   template <typename T_action>
1153   static void do_visit_each(const T_action& _A_action,
1154                             const slot4<T_return, T_arg1, T_arg2, T_arg3, T_arg4>& _A_target)
1155   {
1156     _A_action(_A_target);
1157   }
1158 };
1159 #endif // DOXYGEN_SHOULD_SKIP_THIS
1160
1161 /** Converts an arbitrary functor to a unified type which is opaque.
1162  * sigc::slot itself is a functor or to be more precise a closure. It contains
1163  * a single, arbitrary functor (or closure) that is executed in operator()().
1164  *
1165  * The template arguments determine the function signature of operator()():
1166  * - @e T_return The return type of operator()().
1167  * - @e T_arg1 Argument type used in the definition of operator()(). The default @p nil means no argument.
1168  * - @e T_arg2 Argument type used in the definition of operator()(). The default @p nil means no argument.
1169  * - @e T_arg3 Argument type used in the definition of operator()(). The default @p nil means no argument.
1170  * - @e T_arg4 Argument type used in the definition of operator()(). The default @p nil means no argument.
1171  * - @e T_arg5 Argument type used in the definition of operator()(). The default @p nil means no argument.
1172  *
1173  * To use simply assign the desired functor to the slot. If the functor
1174  * is not compatible with the parameter list defined with the template
1175  * arguments compiler errors are triggered. When called the slot
1176  * will invoke the functor with minimal copies.
1177  * block() and unblock() can be used to block the functor's invocation
1178  * from operator()() temporarily.
1179  *
1180  * You should use the more convenient unnumbered sigc::slot template.
1181  *
1182  * @ingroup slot
1183  */
1184 template <class T_return, class T_arg1, class T_arg2, class T_arg3, class T_arg4, class T_arg5>
1185 class slot5
1186   : public slot_base
1187 {
1188 public:
1189   typedef T_return result_type;
1190   typedef type_trait_take_t<T_arg1> arg1_type_;
1191   typedef type_trait_take_t<T_arg2> arg2_type_;
1192   typedef type_trait_take_t<T_arg3> arg3_type_;
1193   typedef type_trait_take_t<T_arg4> arg4_type_;
1194   typedef type_trait_take_t<T_arg5> arg5_type_;
1195
1196
1197 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1198 private:
1199   typedef internal::slot_rep rep_type;
1200 public:
1201   typedef T_return (*call_type)(rep_type*, arg1_type_, arg2_type_, arg3_type_, arg4_type_, arg5_type_);
1202 #endif
1203
1204   /** Invoke the contained functor unless slot is in blocking state.
1205    * @param _A_a1 Argument to be passed on to the functor.
1206    * @param _A_a2 Argument to be passed on to the functor.
1207    * @param _A_a3 Argument to be passed on to the functor.
1208    * @param _A_a4 Argument to be passed on to the functor.
1209    * @param _A_a5 Argument to be passed on to the functor.
1210    * @return The return value of the functor invocation.
1211    */
1212   inline T_return operator()(arg1_type_ _A_a1, arg2_type_ _A_a2, arg3_type_ _A_a3, arg4_type_ _A_a4, arg5_type_ _A_a5) const
1213     {
1214       if (!empty() && !blocked())
1215         return (sigc::internal::function_pointer_cast<call_type>(slot_base::rep_->call_))(slot_base::rep_, _A_a1, _A_a2, _A_a3, _A_a4, _A_a5);
1216       return T_return();
1217     }
1218
1219   inline slot5() {}
1220
1221   /** Constructs a slot from an arbitrary functor.
1222    * @param _A_func The desired functor the new slot should be assigned to.
1223    */
1224   template <class T_functor>
1225   slot5(const T_functor& _A_func)
1226     : slot_base(new internal::typed_slot_rep<T_functor>(_A_func))
1227     {
1228       //The slot_base:: is necessary to stop the HP-UX aCC compiler from being confused. murrayc.
1229       slot_base::rep_->call_ = internal::slot_call5<T_functor, T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5>::address();
1230     }
1231
1232   /** Constructs a slot, copying an existing one.
1233    * @param src The existing slot to copy.
1234    */
1235   slot5(const slot5& src)
1236     : slot_base(src)
1237     {}
1238
1239   /** Constructs a slot, moving an existing one.
1240    * If @p src is connected to a parent (e.g. a signal), it is copied, not moved.
1241    * @param src The existing slot to move or copy.
1242    */
1243   slot5(slot5&& src)
1244     : slot_base(std::move(src))
1245     {}
1246
1247   /** Overrides this slot, making a copy from another slot.
1248    * @param src The slot from which to make a copy.
1249    * @return @p this.
1250    */
1251   slot5& operator=(const slot5& src)
1252   {
1253     slot_base::operator=(src);
1254     return *this;
1255   }
1256
1257   /** Overrides this slot, making a move from another slot.
1258    * If @p src is connected to a parent (e.g. a signal), it is copied, not moved.
1259    * @param src The slot from which to move or copy.
1260    * @return @p this.
1261    */
1262   slot5& operator=(slot5&& src)
1263   {
1264     slot_base::operator=(std::move(src));
1265     return *this;
1266   }
1267 };
1268
1269 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1270 //template specialization of visitor<>::do_visit_each<>(action, functor):
1271 /** Performs a functor on each of the targets of a functor.
1272  * The function overloads for sigc::slot5 are similar to the function
1273  * overloads for sigc::slot. See the description of those overloads.
1274  *
1275  * @ingroup slot
1276  */
1277 template <typename T_return, typename T_arg1, typename T_arg2, typename T_arg3, typename T_arg4, typename T_arg5>
1278 struct visitor<slot5<T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5>>
1279 {
1280   static void do_visit_each(const internal::limit_derived_target<trackable*, internal::slot_do_bind>& _A_action,
1281                             const slot5<T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5>& _A_target)
1282   {
1283     if (_A_target.rep_ && _A_target.rep_->parent_ == nullptr)
1284     _A_target.rep_->set_parent(_A_action.action_.rep_, &internal::slot_rep::notify);
1285   }
1286
1287   static void do_visit_each(const internal::limit_derived_target<trackable*, internal::slot_do_unbind>& _A_action,
1288                             const slot5<T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5>& _A_target)
1289   {
1290     if (_A_target.rep_ && _A_target.rep_->parent_ == _A_action.action_.rep_)
1291       _A_target.rep_->set_parent(nullptr, nullptr);
1292   }
1293
1294   template <typename T_action>
1295   static void do_visit_each(const T_action& _A_action,
1296                             const slot5<T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5>& _A_target)
1297   {
1298     _A_action(_A_target);
1299   }
1300 };
1301 #endif // DOXYGEN_SHOULD_SKIP_THIS
1302
1303 /** Converts an arbitrary functor to a unified type which is opaque.
1304  * sigc::slot itself is a functor or to be more precise a closure. It contains
1305  * a single, arbitrary functor (or closure) that is executed in operator()().
1306  *
1307  * The template arguments determine the function signature of operator()():
1308  * - @e T_return The return type of operator()().
1309  * - @e T_arg1 Argument type used in the definition of operator()(). The default @p nil means no argument.
1310  * - @e T_arg2 Argument type used in the definition of operator()(). The default @p nil means no argument.
1311  * - @e T_arg3 Argument type used in the definition of operator()(). The default @p nil means no argument.
1312  * - @e T_arg4 Argument type used in the definition of operator()(). The default @p nil means no argument.
1313  * - @e T_arg5 Argument type used in the definition of operator()(). The default @p nil means no argument.
1314  * - @e T_arg6 Argument type used in the definition of operator()(). The default @p nil means no argument.
1315  *
1316  * To use simply assign the desired functor to the slot. If the functor
1317  * is not compatible with the parameter list defined with the template
1318  * arguments compiler errors are triggered. When called the slot
1319  * will invoke the functor with minimal copies.
1320  * block() and unblock() can be used to block the functor's invocation
1321  * from operator()() temporarily.
1322  *
1323  * You should use the more convenient unnumbered sigc::slot template.
1324  *
1325  * @ingroup slot
1326  */
1327 template <class T_return, class T_arg1, class T_arg2, class T_arg3, class T_arg4, class T_arg5, class T_arg6>
1328 class slot6
1329   : public slot_base
1330 {
1331 public:
1332   typedef T_return result_type;
1333   typedef type_trait_take_t<T_arg1> arg1_type_;
1334   typedef type_trait_take_t<T_arg2> arg2_type_;
1335   typedef type_trait_take_t<T_arg3> arg3_type_;
1336   typedef type_trait_take_t<T_arg4> arg4_type_;
1337   typedef type_trait_take_t<T_arg5> arg5_type_;
1338   typedef type_trait_take_t<T_arg6> arg6_type_;
1339
1340
1341 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1342 private:
1343   typedef internal::slot_rep rep_type;
1344 public:
1345   typedef T_return (*call_type)(rep_type*, arg1_type_, arg2_type_, arg3_type_, arg4_type_, arg5_type_, arg6_type_);
1346 #endif
1347
1348   /** Invoke the contained functor unless slot is in blocking state.
1349    * @param _A_a1 Argument to be passed on to the functor.
1350    * @param _A_a2 Argument to be passed on to the functor.
1351    * @param _A_a3 Argument to be passed on to the functor.
1352    * @param _A_a4 Argument to be passed on to the functor.
1353    * @param _A_a5 Argument to be passed on to the functor.
1354    * @param _A_a6 Argument to be passed on to the functor.
1355    * @return The return value of the functor invocation.
1356    */
1357   inline T_return operator()(arg1_type_ _A_a1, arg2_type_ _A_a2, arg3_type_ _A_a3, arg4_type_ _A_a4, arg5_type_ _A_a5, arg6_type_ _A_a6) const
1358     {
1359       if (!empty() && !blocked())
1360         return (sigc::internal::function_pointer_cast<call_type>(slot_base::rep_->call_))(slot_base::rep_, _A_a1, _A_a2, _A_a3, _A_a4, _A_a5, _A_a6);
1361       return T_return();
1362     }
1363
1364   inline slot6() {}
1365
1366   /** Constructs a slot from an arbitrary functor.
1367    * @param _A_func The desired functor the new slot should be assigned to.
1368    */
1369   template <class T_functor>
1370   slot6(const T_functor& _A_func)
1371     : slot_base(new internal::typed_slot_rep<T_functor>(_A_func))
1372     {
1373       //The slot_base:: is necessary to stop the HP-UX aCC compiler from being confused. murrayc.
1374       slot_base::rep_->call_ = internal::slot_call6<T_functor, T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6>::address();
1375     }
1376
1377   /** Constructs a slot, copying an existing one.
1378    * @param src The existing slot to copy.
1379    */
1380   slot6(const slot6& src)
1381     : slot_base(src)
1382     {}
1383
1384   /** Constructs a slot, moving an existing one.
1385    * If @p src is connected to a parent (e.g. a signal), it is copied, not moved.
1386    * @param src The existing slot to move or copy.
1387    */
1388   slot6(slot6&& src)
1389     : slot_base(std::move(src))
1390     {}
1391
1392   /** Overrides this slot, making a copy from another slot.
1393    * @param src The slot from which to make a copy.
1394    * @return @p this.
1395    */
1396   slot6& operator=(const slot6& src)
1397   {
1398     slot_base::operator=(src);
1399     return *this;
1400   }
1401
1402   /** Overrides this slot, making a move from another slot.
1403    * If @p src is connected to a parent (e.g. a signal), it is copied, not moved.
1404    * @param src The slot from which to move or copy.
1405    * @return @p this.
1406    */
1407   slot6& operator=(slot6&& src)
1408   {
1409     slot_base::operator=(std::move(src));
1410     return *this;
1411   }
1412 };
1413
1414 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1415 //template specialization of visitor<>::do_visit_each<>(action, functor):
1416 /** Performs a functor on each of the targets of a functor.
1417  * The function overloads for sigc::slot6 are similar to the function
1418  * overloads for sigc::slot. See the description of those overloads.
1419  *
1420  * @ingroup slot
1421  */
1422 template <typename T_return, typename T_arg1, typename T_arg2, typename T_arg3, typename T_arg4, typename T_arg5, typename T_arg6>
1423 struct visitor<slot6<T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6>>
1424 {
1425   static void do_visit_each(const internal::limit_derived_target<trackable*, internal::slot_do_bind>& _A_action,
1426                             const slot6<T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6>& _A_target)
1427   {
1428     if (_A_target.rep_ && _A_target.rep_->parent_ == nullptr)
1429     _A_target.rep_->set_parent(_A_action.action_.rep_, &internal::slot_rep::notify);
1430   }
1431
1432   static void do_visit_each(const internal::limit_derived_target<trackable*, internal::slot_do_unbind>& _A_action,
1433                             const slot6<T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6>& _A_target)
1434   {
1435     if (_A_target.rep_ && _A_target.rep_->parent_ == _A_action.action_.rep_)
1436       _A_target.rep_->set_parent(nullptr, nullptr);
1437   }
1438
1439   template <typename T_action>
1440   static void do_visit_each(const T_action& _A_action,
1441                             const slot6<T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6>& _A_target)
1442   {
1443     _A_action(_A_target);
1444   }
1445 };
1446 #endif // DOXYGEN_SHOULD_SKIP_THIS
1447
1448 /** Converts an arbitrary functor to a unified type which is opaque.
1449  * sigc::slot itself is a functor or to be more precise a closure. It contains
1450  * a single, arbitrary functor (or closure) that is executed in operator()().
1451  *
1452  * The template arguments determine the function signature of operator()():
1453  * - @e T_return The return type of operator()().
1454  * - @e T_arg1 Argument type used in the definition of operator()(). The default @p nil means no argument.
1455  * - @e T_arg2 Argument type used in the definition of operator()(). The default @p nil means no argument.
1456  * - @e T_arg3 Argument type used in the definition of operator()(). The default @p nil means no argument.
1457  * - @e T_arg4 Argument type used in the definition of operator()(). The default @p nil means no argument.
1458  * - @e T_arg5 Argument type used in the definition of operator()(). The default @p nil means no argument.
1459  * - @e T_arg6 Argument type used in the definition of operator()(). The default @p nil means no argument.
1460  * - @e T_arg7 Argument type used in the definition of operator()(). The default @p nil means no argument.
1461  *
1462  * To use simply assign the desired functor to the slot. If the functor
1463  * is not compatible with the parameter list defined with the template
1464  * arguments compiler errors are triggered. When called the slot
1465  * will invoke the functor with minimal copies.
1466  * block() and unblock() can be used to block the functor's invocation
1467  * from operator()() temporarily.
1468  *
1469  * You should use the more convenient unnumbered sigc::slot template.
1470  *
1471  * @ingroup slot
1472  */
1473 template <class T_return, class T_arg1, class T_arg2, class T_arg3, class T_arg4, class T_arg5, class T_arg6, class T_arg7>
1474 class slot7
1475   : public slot_base
1476 {
1477 public:
1478   typedef T_return result_type;
1479   typedef type_trait_take_t<T_arg1> arg1_type_;
1480   typedef type_trait_take_t<T_arg2> arg2_type_;
1481   typedef type_trait_take_t<T_arg3> arg3_type_;
1482   typedef type_trait_take_t<T_arg4> arg4_type_;
1483   typedef type_trait_take_t<T_arg5> arg5_type_;
1484   typedef type_trait_take_t<T_arg6> arg6_type_;
1485   typedef type_trait_take_t<T_arg7> arg7_type_;
1486
1487
1488 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1489 private:
1490   typedef internal::slot_rep rep_type;
1491 public:
1492   typedef T_return (*call_type)(rep_type*, arg1_type_, arg2_type_, arg3_type_, arg4_type_, arg5_type_, arg6_type_, arg7_type_);
1493 #endif
1494
1495   /** Invoke the contained functor unless slot is in blocking state.
1496    * @param _A_a1 Argument to be passed on to the functor.
1497    * @param _A_a2 Argument to be passed on to the functor.
1498    * @param _A_a3 Argument to be passed on to the functor.
1499    * @param _A_a4 Argument to be passed on to the functor.
1500    * @param _A_a5 Argument to be passed on to the functor.
1501    * @param _A_a6 Argument to be passed on to the functor.
1502    * @param _A_a7 Argument to be passed on to the functor.
1503    * @return The return value of the functor invocation.
1504    */
1505   inline T_return operator()(arg1_type_ _A_a1, arg2_type_ _A_a2, arg3_type_ _A_a3, arg4_type_ _A_a4, arg5_type_ _A_a5, arg6_type_ _A_a6, arg7_type_ _A_a7) const
1506     {
1507       if (!empty() && !blocked())
1508         return (sigc::internal::function_pointer_cast<call_type>(slot_base::rep_->call_))(slot_base::rep_, _A_a1, _A_a2, _A_a3, _A_a4, _A_a5, _A_a6, _A_a7);
1509       return T_return();
1510     }
1511
1512   inline slot7() {}
1513
1514   /** Constructs a slot from an arbitrary functor.
1515    * @param _A_func The desired functor the new slot should be assigned to.
1516    */
1517   template <class T_functor>
1518   slot7(const T_functor& _A_func)
1519     : slot_base(new internal::typed_slot_rep<T_functor>(_A_func))
1520     {
1521       //The slot_base:: is necessary to stop the HP-UX aCC compiler from being confused. murrayc.
1522       slot_base::rep_->call_ = internal::slot_call7<T_functor, T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7>::address();
1523     }
1524
1525   /** Constructs a slot, copying an existing one.
1526    * @param src The existing slot to copy.
1527    */
1528   slot7(const slot7& src)
1529     : slot_base(src)
1530     {}
1531
1532   /** Constructs a slot, moving an existing one.
1533    * If @p src is connected to a parent (e.g. a signal), it is copied, not moved.
1534    * @param src The existing slot to move or copy.
1535    */
1536   slot7(slot7&& src)
1537     : slot_base(std::move(src))
1538     {}
1539
1540   /** Overrides this slot, making a copy from another slot.
1541    * @param src The slot from which to make a copy.
1542    * @return @p this.
1543    */
1544   slot7& operator=(const slot7& src)
1545   {
1546     slot_base::operator=(src);
1547     return *this;
1548   }
1549
1550   /** Overrides this slot, making a move from another slot.
1551    * If @p src is connected to a parent (e.g. a signal), it is copied, not moved.
1552    * @param src The slot from which to move or copy.
1553    * @return @p this.
1554    */
1555   slot7& operator=(slot7&& src)
1556   {
1557     slot_base::operator=(std::move(src));
1558     return *this;
1559   }
1560 };
1561
1562 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1563 //template specialization of visitor<>::do_visit_each<>(action, functor):
1564 /** Performs a functor on each of the targets of a functor.
1565  * The function overloads for sigc::slot7 are similar to the function
1566  * overloads for sigc::slot. See the description of those overloads.
1567  *
1568  * @ingroup slot
1569  */
1570 template <typename T_return, typename T_arg1, typename T_arg2, typename T_arg3, typename T_arg4, typename T_arg5, typename T_arg6, typename T_arg7>
1571 struct visitor<slot7<T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7>>
1572 {
1573   static void do_visit_each(const internal::limit_derived_target<trackable*, internal::slot_do_bind>& _A_action,
1574                             const slot7<T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7>& _A_target)
1575   {
1576     if (_A_target.rep_ && _A_target.rep_->parent_ == nullptr)
1577     _A_target.rep_->set_parent(_A_action.action_.rep_, &internal::slot_rep::notify);
1578   }
1579
1580   static void do_visit_each(const internal::limit_derived_target<trackable*, internal::slot_do_unbind>& _A_action,
1581                             const slot7<T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7>& _A_target)
1582   {
1583     if (_A_target.rep_ && _A_target.rep_->parent_ == _A_action.action_.rep_)
1584       _A_target.rep_->set_parent(nullptr, nullptr);
1585   }
1586
1587   template <typename T_action>
1588   static void do_visit_each(const T_action& _A_action,
1589                             const slot7<T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7>& _A_target)
1590   {
1591     _A_action(_A_target);
1592   }
1593 };
1594 #endif // DOXYGEN_SHOULD_SKIP_THIS
1595
1596
1597 // Because slot is opaque, visit_each() will not visit its internal members.
1598 // Those members are not reachable by visit_each() after the slot has been
1599 // constructed. But when a slot contains another slot, the outer slot will become
1600 // the parent of the inner slot, with similar results. See the description of
1601 // slot's specialization of the visitor struct.
1602 /** Convenience wrapper for the numbered sigc::slot# templates.
1603  * Slots convert arbitrary functors to unified types which are opaque.
1604  * sigc::slot itself is a functor or to be more precise a closure. It contains
1605  * a single, arbitrary functor (or closure) that is executed in operator()().
1606  *
1607  * The template arguments determine the function signature of operator()():
1608  * - @e T_return The return type of operator()().
1609  * - @e T_arg1 Argument type used in the definition of operator()(). The default @p nil means no argument.
1610  * - @e T_arg2 Argument type used in the definition of operator()(). The default @p nil means no argument.
1611  * - @e T_arg3 Argument type used in the definition of operator()(). The default @p nil means no argument.
1612  * - @e T_arg4 Argument type used in the definition of operator()(). The default @p nil means no argument.
1613  * - @e T_arg5 Argument type used in the definition of operator()(). The default @p nil means no argument.
1614  * - @e T_arg6 Argument type used in the definition of operator()(). The default @p nil means no argument.
1615  * - @e T_arg7 Argument type used in the definition of operator()(). The default @p nil means no argument.
1616  *
1617  * To use, simply assign the desired functor to the slot. If the functor
1618  * is not compatible with the parameter list defined with the template
1619  * arguments, compiler errors are triggered. When called, the slot
1620  * will invoke the functor with minimal copies.
1621  * block() and unblock() can be used to temporarily block the functor's
1622  * invocation from operator()().
1623  *
1624  * @par Example:
1625  * @code
1626  * void foo(int) {}
1627  * sigc::slot<void, int> s = sigc::ptr_fun(&foo);
1628  * s(19);
1629  * @endcode
1630  *
1631  * sigc::slot<> is similar to std::function<>. If you're going to assign the
1632  * resulting functor to a sigc::slot or connect it to a sigc::signal, it's better
1633  * not to use std::function. It would become an unnecessary extra wrapper.
1634  *
1635  * @deprecated Please use the syntax similar to that used by std::function<>:
1636  * @code
1637  * sigc::slot<void(bool, int)> some_slot;
1638  * @endcode
1639  *
1640  * @ingroup slot
1641  */
1642 template <class T_return, class T_arg1 = nil, class T_arg2 = nil, class T_arg3 = nil, class T_arg4 = nil, class T_arg5 = nil, class T_arg6 = nil, class T_arg7 = nil>
1643 class slot
1644   : public slot7<T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7>
1645 {
1646 public:
1647   typedef slot7<T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7> parent_type;
1648
1649   inline slot() {}
1650
1651   /** Constructs a slot from an arbitrary functor.
1652    * @param _A_func The desired functor the new slot should be assigned to.
1653    */
1654   template <class T_functor>
1655   slot(const T_functor& _A_func)
1656     : parent_type(_A_func) {}
1657
1658   // Without static_cast parent_type(const T_functor& _A_func)
1659   // is called instead of the copy constructor.
1660   /** Constructs a slot, copying an existing one.
1661    * @param src The existing slot to copy.
1662    */
1663   slot(const slot& src)
1664     : parent_type(static_cast<const parent_type&>(src)) {}
1665
1666   // Without static_cast parent_type(const T_functor& _A_func)
1667   // is called instead of the move constructor.
1668   /** Constructs a slot, moving an existing one.
1669    * If @p src is connected to a parent (e.g. a signal), it is copied, not moved.
1670    * @param src The existing slot to move or copy.
1671    */
1672   slot(slot&& src)
1673     : parent_type(std::move(static_cast<parent_type&>(src))) {}
1674
1675   /** Overrides this slot, making a copy from another slot.
1676    * @param src The slot from which to make a copy.
1677    * @return @p this.
1678    */
1679   slot& operator=(const slot& src)
1680   {
1681     parent_type::operator=(src);
1682     return *this;
1683   }
1684
1685   /** Overrides this slot, making a move from another slot.
1686    * If @p src is connected to a parent (e.g. a signal), it is copied, not moved.
1687    * @param src The slot from which to move or copy.
1688    * @return @p this.
1689    */
1690   slot& operator=(slot&& src)
1691   {
1692     parent_type::operator=(std::move(src));
1693     return *this;
1694   }
1695 };
1696
1697 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1698 //template specialization of visitor<>::do_visit_each<>(action, functor):
1699 /** Performs a functor on each of the targets of a functor.
1700  *
1701  * There are three function overloads for sigc::slot.
1702  *
1703  * The first two overloads are very specialized. They handle the (probably unusual)
1704  * case when the functor, stored in a slot, contains a slot. They are invoked from
1705  * the constructor, destructor or destroy() method of typed_slot_rep.
1706  * The first overload, called from the constructor of the outer slot, sets
1707  * the outer slot as the parent of the inner slot. The second overload, called from
1708  * the destructor or destroy() of the outer slot, unsets the parent of the inner slot.
1709  * When an object referenced from the inner slot is deleted, the inner slot calls
1710  * its slot_rep::disconnect(), which calls the outer slot's slot_rep::notify().
1711  * The outer slot is informed just as if one of its directly referenced objects
1712  * had been deleted. Result: The outer slot is disconnected from its parent,
1713  * if any (for instance a sigc::signal).
1714  * See https://bugzilla.gnome.org/show_bug.cgi?id=755003
1715  *
1716  * The third overload is identical to do_visit_each() in visitor's primary template.
1717  *
1718  * @ingroup slot
1719  */
1720 template <typename T_return, typename T_arg1, typename T_arg2, typename T_arg3, typename T_arg4, typename T_arg5, typename T_arg6, typename T_arg7>
1721 struct visitor<slot<T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7>>
1722 {
1723   static void do_visit_each(const internal::limit_derived_target<trackable*, internal::slot_do_bind>& _A_action,
1724                             const slot<T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7>& _A_target)
1725   {
1726     if (_A_target.rep_ && _A_target.rep_->parent_ == nullptr)
1727       _A_target.rep_->set_parent(_A_action.action_.rep_, &internal::slot_rep::notify);
1728   }
1729
1730   static void do_visit_each(const internal::limit_derived_target<trackable*, internal::slot_do_unbind>& _A_action,
1731                             const slot<T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7>& _A_target)
1732   {
1733     if (_A_target.rep_ && _A_target.rep_->parent_ == _A_action.action_.rep_)
1734       _A_target.rep_->set_parent(nullptr, nullptr);
1735   }
1736
1737   template <typename T_action>
1738   static void do_visit_each(const T_action& _A_action,
1739                             const slot<T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7>& _A_target)
1740   {
1741     _A_action(_A_target);
1742   }
1743 };
1744 #endif // DOXYGEN_SHOULD_SKIP_THIS
1745
1746
1747
1748 /** Convenience wrapper for the numbered sigc::slot0 template.
1749  * See the base class for useful methods.
1750  * This is the template specialization of the unnumbered sigc::slot
1751  * template for 0 argument(s), specialized for different numbers of arguments
1752  * This is possible because the template has default (nil) template types.
1753  *
1754  * @deprecated Please use the syntax similar to that used by std::function<>:
1755  * @code
1756  * sigc::slot<void(bool, int)> some_slot;
1757  * @endcode
1758  *
1759  */
1760 template <class T_return>
1761 class slot <T_return, nil, nil, nil, nil, nil, nil, nil>
1762   : public slot0<T_return>
1763 {
1764 public:
1765   typedef slot0<T_return> parent_type;
1766
1767   inline slot() {}
1768
1769   /** Constructs a slot from an arbitrary functor.
1770    * @param _A_func The desired functor the new slot should be assigned to.
1771    */
1772   template <class T_functor>
1773   slot(const T_functor& _A_func)
1774     : parent_type(_A_func) {}
1775
1776   // Without static_cast parent_type(const T_functor& _A_func)
1777   // is called instead of the copy constructor.
1778   /** Constructs a slot, copying an existing one.
1779    * @param src The existing slot to copy.
1780    */
1781   slot(const slot& src)
1782     : parent_type(static_cast<const parent_type&>(src)) {}
1783
1784   // Without static_cast parent_type(const T_functor& _A_func)
1785   // is called instead of the move constructor.
1786   /** Constructs a slot, moving an existing one.
1787    * If @p src is connected to a parent (e.g. a signal), it is copied, not moved.
1788    * @param src The existing slot to move or copy.
1789    */
1790   slot(slot&& src)
1791     : parent_type(std::move(static_cast<parent_type&>(src))) {}
1792
1793   /** Overrides this slot, making a copy from another slot.
1794    * @param src The slot from which to make a copy.
1795    * @return @p this.
1796    */
1797   slot& operator=(const slot& src)
1798   {
1799     parent_type::operator=(src);
1800     return *this;
1801   }
1802
1803   /** Overrides this slot, making a move from another slot.
1804    * If @p src is connected to a parent (e.g. a signal), it is copied, not moved.
1805    * @param src The slot from which to move or copy.
1806    * @return @p this.
1807    */
1808   slot& operator=(slot&& src)
1809   {
1810     parent_type::operator=(std::move(src));
1811     return *this;
1812   }
1813 };
1814
1815
1816
1817 /** Convenience wrapper for the numbered sigc::slot1 template.
1818  * See the base class for useful methods.
1819  * This is the template specialization of the unnumbered sigc::slot
1820  * template for 1 argument(s), specialized for different numbers of arguments
1821  * This is possible because the template has default (nil) template types.
1822  *
1823  * @deprecated Please use the syntax similar to that used by std::function<>:
1824  * @code
1825  * sigc::slot<void(bool, int)> some_slot;
1826  * @endcode
1827  *
1828  */
1829 template <class T_return, class T_arg1>
1830 class slot <T_return, T_arg1, nil, nil, nil, nil, nil, nil>
1831   : public slot1<T_return, T_arg1>
1832 {
1833 public:
1834   typedef slot1<T_return, T_arg1> parent_type;
1835
1836   inline slot() {}
1837
1838   /** Constructs a slot from an arbitrary functor.
1839    * @param _A_func The desired functor the new slot should be assigned to.
1840    */
1841   template <class T_functor>
1842   slot(const T_functor& _A_func)
1843     : parent_type(_A_func) {}
1844
1845   // Without static_cast parent_type(const T_functor& _A_func)
1846   // is called instead of the copy constructor.
1847   /** Constructs a slot, copying an existing one.
1848    * @param src The existing slot to copy.
1849    */
1850   slot(const slot& src)
1851     : parent_type(static_cast<const parent_type&>(src)) {}
1852
1853   // Without static_cast parent_type(const T_functor& _A_func)
1854   // is called instead of the move constructor.
1855   /** Constructs a slot, moving an existing one.
1856    * If @p src is connected to a parent (e.g. a signal), it is copied, not moved.
1857    * @param src The existing slot to move or copy.
1858    */
1859   slot(slot&& src)
1860     : parent_type(std::move(static_cast<parent_type&>(src))) {}
1861
1862   /** Overrides this slot, making a copy from another slot.
1863    * @param src The slot from which to make a copy.
1864    * @return @p this.
1865    */
1866   slot& operator=(const slot& src)
1867   {
1868     parent_type::operator=(src);
1869     return *this;
1870   }
1871
1872   /** Overrides this slot, making a move from another slot.
1873    * If @p src is connected to a parent (e.g. a signal), it is copied, not moved.
1874    * @param src The slot from which to move or copy.
1875    * @return @p this.
1876    */
1877   slot& operator=(slot&& src)
1878   {
1879     parent_type::operator=(std::move(src));
1880     return *this;
1881   }
1882 };
1883
1884
1885
1886 /** Convenience wrapper for the numbered sigc::slot2 template.
1887  * See the base class for useful methods.
1888  * This is the template specialization of the unnumbered sigc::slot
1889  * template for 2 argument(s), specialized for different numbers of arguments
1890  * This is possible because the template has default (nil) template types.
1891  *
1892  * @deprecated Please use the syntax similar to that used by std::function<>:
1893  * @code
1894  * sigc::slot<void(bool, int)> some_slot;
1895  * @endcode
1896  *
1897  */
1898 template <class T_return, class T_arg1, class T_arg2>
1899 class slot <T_return, T_arg1, T_arg2, nil, nil, nil, nil, nil>
1900   : public slot2<T_return, T_arg1, T_arg2>
1901 {
1902 public:
1903   typedef slot2<T_return, T_arg1, T_arg2> parent_type;
1904
1905   inline slot() {}
1906
1907   /** Constructs a slot from an arbitrary functor.
1908    * @param _A_func The desired functor the new slot should be assigned to.
1909    */
1910   template <class T_functor>
1911   slot(const T_functor& _A_func)
1912     : parent_type(_A_func) {}
1913
1914   // Without static_cast parent_type(const T_functor& _A_func)
1915   // is called instead of the copy constructor.
1916   /** Constructs a slot, copying an existing one.
1917    * @param src The existing slot to copy.
1918    */
1919   slot(const slot& src)
1920     : parent_type(static_cast<const parent_type&>(src)) {}
1921
1922   // Without static_cast parent_type(const T_functor& _A_func)
1923   // is called instead of the move constructor.
1924   /** Constructs a slot, moving an existing one.
1925    * If @p src is connected to a parent (e.g. a signal), it is copied, not moved.
1926    * @param src The existing slot to move or copy.
1927    */
1928   slot(slot&& src)
1929     : parent_type(std::move(static_cast<parent_type&>(src))) {}
1930
1931   /** Overrides this slot, making a copy from another slot.
1932    * @param src The slot from which to make a copy.
1933    * @return @p this.
1934    */
1935   slot& operator=(const slot& src)
1936   {
1937     parent_type::operator=(src);
1938     return *this;
1939   }
1940
1941   /** Overrides this slot, making a move from another slot.
1942    * If @p src is connected to a parent (e.g. a signal), it is copied, not moved.
1943    * @param src The slot from which to move or copy.
1944    * @return @p this.
1945    */
1946   slot& operator=(slot&& src)
1947   {
1948     parent_type::operator=(std::move(src));
1949     return *this;
1950   }
1951 };
1952
1953
1954
1955 /** Convenience wrapper for the numbered sigc::slot3 template.
1956  * See the base class for useful methods.
1957  * This is the template specialization of the unnumbered sigc::slot
1958  * template for 3 argument(s), specialized for different numbers of arguments
1959  * This is possible because the template has default (nil) template types.
1960  *
1961  * @deprecated Please use the syntax similar to that used by std::function<>:
1962  * @code
1963  * sigc::slot<void(bool, int)> some_slot;
1964  * @endcode
1965  *
1966  */
1967 template <class T_return, class T_arg1, class T_arg2, class T_arg3>
1968 class slot <T_return, T_arg1, T_arg2, T_arg3, nil, nil, nil, nil>
1969   : public slot3<T_return, T_arg1, T_arg2, T_arg3>
1970 {
1971 public:
1972   typedef slot3<T_return, T_arg1, T_arg2, T_arg3> parent_type;
1973
1974   inline slot() {}
1975
1976   /** Constructs a slot from an arbitrary functor.
1977    * @param _A_func The desired functor the new slot should be assigned to.
1978    */
1979   template <class T_functor>
1980   slot(const T_functor& _A_func)
1981     : parent_type(_A_func) {}
1982
1983   // Without static_cast parent_type(const T_functor& _A_func)
1984   // is called instead of the copy constructor.
1985   /** Constructs a slot, copying an existing one.
1986    * @param src The existing slot to copy.
1987    */
1988   slot(const slot& src)
1989     : parent_type(static_cast<const parent_type&>(src)) {}
1990
1991   // Without static_cast parent_type(const T_functor& _A_func)
1992   // is called instead of the move constructor.
1993   /** Constructs a slot, moving an existing one.
1994    * If @p src is connected to a parent (e.g. a signal), it is copied, not moved.
1995    * @param src The existing slot to move or copy.
1996    */
1997   slot(slot&& src)
1998     : parent_type(std::move(static_cast<parent_type&>(src))) {}
1999
2000   /** Overrides this slot, making a copy from another slot.
2001    * @param src The slot from which to make a copy.
2002    * @return @p this.
2003    */
2004   slot& operator=(const slot& src)
2005   {
2006     parent_type::operator=(src);
2007     return *this;
2008   }
2009
2010   /** Overrides this slot, making a move from another slot.
2011    * If @p src is connected to a parent (e.g. a signal), it is copied, not moved.
2012    * @param src The slot from which to move or copy.
2013    * @return @p this.
2014    */
2015   slot& operator=(slot&& src)
2016   {
2017     parent_type::operator=(std::move(src));
2018     return *this;
2019   }
2020 };
2021
2022
2023
2024 /** Convenience wrapper for the numbered sigc::slot4 template.
2025  * See the base class for useful methods.
2026  * This is the template specialization of the unnumbered sigc::slot
2027  * template for 4 argument(s), specialized for different numbers of arguments
2028  * This is possible because the template has default (nil) template types.
2029  *
2030  * @deprecated Please use the syntax similar to that used by std::function<>:
2031  * @code
2032  * sigc::slot<void(bool, int)> some_slot;
2033  * @endcode
2034  *
2035  */
2036 template <class T_return, class T_arg1, class T_arg2, class T_arg3, class T_arg4>
2037 class slot <T_return, T_arg1, T_arg2, T_arg3, T_arg4, nil, nil, nil>
2038   : public slot4<T_return, T_arg1, T_arg2, T_arg3, T_arg4>
2039 {
2040 public:
2041   typedef slot4<T_return, T_arg1, T_arg2, T_arg3, T_arg4> parent_type;
2042
2043   inline slot() {}
2044
2045   /** Constructs a slot from an arbitrary functor.
2046    * @param _A_func The desired functor the new slot should be assigned to.
2047    */
2048   template <class T_functor>
2049   slot(const T_functor& _A_func)
2050     : parent_type(_A_func) {}
2051
2052   // Without static_cast parent_type(const T_functor& _A_func)
2053   // is called instead of the copy constructor.
2054   /** Constructs a slot, copying an existing one.
2055    * @param src The existing slot to copy.
2056    */
2057   slot(const slot& src)
2058     : parent_type(static_cast<const parent_type&>(src)) {}
2059
2060   // Without static_cast parent_type(const T_functor& _A_func)
2061   // is called instead of the move constructor.
2062   /** Constructs a slot, moving an existing one.
2063    * If @p src is connected to a parent (e.g. a signal), it is copied, not moved.
2064    * @param src The existing slot to move or copy.
2065    */
2066   slot(slot&& src)
2067     : parent_type(std::move(static_cast<parent_type&>(src))) {}
2068
2069   /** Overrides this slot, making a copy from another slot.
2070    * @param src The slot from which to make a copy.
2071    * @return @p this.
2072    */
2073   slot& operator=(const slot& src)
2074   {
2075     parent_type::operator=(src);
2076     return *this;
2077   }
2078
2079   /** Overrides this slot, making a move from another slot.
2080    * If @p src is connected to a parent (e.g. a signal), it is copied, not moved.
2081    * @param src The slot from which to move or copy.
2082    * @return @p this.
2083    */
2084   slot& operator=(slot&& src)
2085   {
2086     parent_type::operator=(std::move(src));
2087     return *this;
2088   }
2089 };
2090
2091
2092
2093 /** Convenience wrapper for the numbered sigc::slot5 template.
2094  * See the base class for useful methods.
2095  * This is the template specialization of the unnumbered sigc::slot
2096  * template for 5 argument(s), specialized for different numbers of arguments
2097  * This is possible because the template has default (nil) template types.
2098  *
2099  * @deprecated Please use the syntax similar to that used by std::function<>:
2100  * @code
2101  * sigc::slot<void(bool, int)> some_slot;
2102  * @endcode
2103  *
2104  */
2105 template <class T_return, class T_arg1, class T_arg2, class T_arg3, class T_arg4, class T_arg5>
2106 class slot <T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, nil, nil>
2107   : public slot5<T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5>
2108 {
2109 public:
2110   typedef slot5<T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5> parent_type;
2111
2112   inline slot() {}
2113
2114   /** Constructs a slot from an arbitrary functor.
2115    * @param _A_func The desired functor the new slot should be assigned to.
2116    */
2117   template <class T_functor>
2118   slot(const T_functor& _A_func)
2119     : parent_type(_A_func) {}
2120
2121   // Without static_cast parent_type(const T_functor& _A_func)
2122   // is called instead of the copy constructor.
2123   /** Constructs a slot, copying an existing one.
2124    * @param src The existing slot to copy.
2125    */
2126   slot(const slot& src)
2127     : parent_type(static_cast<const parent_type&>(src)) {}
2128
2129   // Without static_cast parent_type(const T_functor& _A_func)
2130   // is called instead of the move constructor.
2131   /** Constructs a slot, moving an existing one.
2132    * If @p src is connected to a parent (e.g. a signal), it is copied, not moved.
2133    * @param src The existing slot to move or copy.
2134    */
2135   slot(slot&& src)
2136     : parent_type(std::move(static_cast<parent_type&>(src))) {}
2137
2138   /** Overrides this slot, making a copy from another slot.
2139    * @param src The slot from which to make a copy.
2140    * @return @p this.
2141    */
2142   slot& operator=(const slot& src)
2143   {
2144     parent_type::operator=(src);
2145     return *this;
2146   }
2147
2148   /** Overrides this slot, making a move from another slot.
2149    * If @p src is connected to a parent (e.g. a signal), it is copied, not moved.
2150    * @param src The slot from which to move or copy.
2151    * @return @p this.
2152    */
2153   slot& operator=(slot&& src)
2154   {
2155     parent_type::operator=(std::move(src));
2156     return *this;
2157   }
2158 };
2159
2160
2161
2162 /** Convenience wrapper for the numbered sigc::slot6 template.
2163  * See the base class for useful methods.
2164  * This is the template specialization of the unnumbered sigc::slot
2165  * template for 6 argument(s), specialized for different numbers of arguments
2166  * This is possible because the template has default (nil) template types.
2167  *
2168  * @deprecated Please use the syntax similar to that used by std::function<>:
2169  * @code
2170  * sigc::slot<void(bool, int)> some_slot;
2171  * @endcode
2172  *
2173  */
2174 template <class T_return, class T_arg1, class T_arg2, class T_arg3, class T_arg4, class T_arg5, class T_arg6>
2175 class slot <T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, nil>
2176   : public slot6<T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6>
2177 {
2178 public:
2179   typedef slot6<T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6> parent_type;
2180
2181   inline slot() {}
2182
2183   /** Constructs a slot from an arbitrary functor.
2184    * @param _A_func The desired functor the new slot should be assigned to.
2185    */
2186   template <class T_functor>
2187   slot(const T_functor& _A_func)
2188     : parent_type(_A_func) {}
2189
2190   // Without static_cast parent_type(const T_functor& _A_func)
2191   // is called instead of the copy constructor.
2192   /** Constructs a slot, copying an existing one.
2193    * @param src The existing slot to copy.
2194    */
2195   slot(const slot& src)
2196     : parent_type(static_cast<const parent_type&>(src)) {}
2197
2198   // Without static_cast parent_type(const T_functor& _A_func)
2199   // is called instead of the move constructor.
2200   /** Constructs a slot, moving an existing one.
2201    * If @p src is connected to a parent (e.g. a signal), it is copied, not moved.
2202    * @param src The existing slot to move or copy.
2203    */
2204   slot(slot&& src)
2205     : parent_type(std::move(static_cast<parent_type&>(src))) {}
2206
2207   /** Overrides this slot, making a copy from another slot.
2208    * @param src The slot from which to make a copy.
2209    * @return @p this.
2210    */
2211   slot& operator=(const slot& src)
2212   {
2213     parent_type::operator=(src);
2214     return *this;
2215   }
2216
2217   /** Overrides this slot, making a move from another slot.
2218    * If @p src is connected to a parent (e.g. a signal), it is copied, not moved.
2219    * @param src The slot from which to move or copy.
2220    * @return @p this.
2221    */
2222   slot& operator=(slot&& src)
2223   {
2224     parent_type::operator=(std::move(src));
2225     return *this;
2226   }
2227 };
2228
2229
2230
2231
2232 /** Converts an arbitrary functor to a unified type which is opaque.
2233  * sigc::slot itself is a functor or, to be more precise, a closure. It contains
2234  * a single, arbitrary functor (or closure) that is executed in operator()().
2235  *
2236  * The template arguments determine the function signature of operator()():
2237  * - @e T_return The return type of operator()().
2238  * - @e T_arg Argument types used in the definition of operator()().
2239  *
2240  * For instance, to declare a slot that returns void and takes two parameters
2241  * of bool and int:
2242  * @code
2243  * sigc::slot<void(bool, int)> some_slot;
2244  * @endcode
2245  *
2246  * Alternatively, you may use this syntax:
2247  * @code
2248  * sigc::slot<void, bool, int> some_slot;
2249  * @endcode
2250  *
2251  * To use, simply assign the desired functor to the slot. If the functor
2252  * is not compatible with the parameter list defined with the template
2253  * arguments then compiler errors are triggered. When called, the slot
2254  * will invoke the functor with minimal copies.
2255  * block() and unblock() can be used to block the functor's invocation
2256  * from operator()() temporarily.
2257  *
2258  * @ingroup slot
2259  */
2260 template <class T_return, class... T_arg>
2261 class slot<T_return(T_arg...)>
2262   : public slot_base
2263 {
2264 public:
2265   using result_type = T_return;
2266   //TODO: using arg_type_ = type_trait_take_t<T_arg>;
2267
2268 #ifndef DOXYGEN_SHOULD_SKIP_THIS
2269 private:
2270   using rep_type = internal::slot_rep;
2271 public:
2272   using call_type = T_return (*)(rep_type*, type_trait_take_t<T_arg>...);
2273 #endif
2274
2275   /** Invoke the contained functor unless slot is in blocking state.
2276    * @param _A_a Arguments to be passed on to the functor.
2277    * @return The return value of the functor invocation.
2278    */
2279   inline T_return operator()(type_trait_take_t<T_arg>... _A_a) const
2280     {
2281       if (!empty() && !blocked())
2282         return (sigc::internal::function_pointer_cast<call_type>(slot_base::rep_->call_))(slot_base::rep_, _A_a...);
2283       return T_return();
2284     }
2285
2286   inline slot() {}
2287
2288   /** Constructs a slot from an arbitrary functor.
2289    * @param _A_func The desired functor the new slot should be assigned to.
2290    */
2291   template <class T_functor>
2292   slot(const T_functor& _A_func)
2293     : slot_base(new internal::typed_slot_rep<T_functor>(_A_func))
2294     {
2295       //The slot_base:: is necessary to stop the HP-UX aCC compiler from being confused. murrayc.
2296       slot_base::rep_->call_ = internal::slot_call<T_functor, T_return, T_arg...>::address();
2297     }
2298
2299   /** Constructs a slot, copying an existing one.
2300    * @param src The existing slot to copy.
2301    */
2302   slot(const slot& src)
2303     : slot_base(src)
2304     {}
2305
2306   /** Constructs a slot, moving an existing one.
2307    * If @p src is connected to a parent (e.g. a signal), it is copied, not moved.
2308    * @param src The existing slot to move or copy.
2309    */
2310   slot(slot&& src)
2311     : slot_base(std::move(src))
2312     {}
2313
2314   /** Overrides this slot, making a copy from another slot.
2315    * @param src The slot from which to make a copy.
2316    * @return @p this.
2317    */
2318   slot& operator=(const slot& src)
2319   {
2320     slot_base::operator=(src);
2321     return *this;
2322   }
2323
2324   /** Overrides this slot, making a move from another slot.
2325    * If @p src is connected to a parent (e.g. a signal), it is copied, not moved.
2326    * @param src The slot from which to move or copy.
2327    * @return @p this.
2328    */
2329   slot& operator=(slot&& src)
2330   {
2331     slot_base::operator=(std::move(src));
2332     return *this;
2333   }
2334 };
2335
2336 } /* namespace sigc */
2337
2338 #ifdef SIGC_NIL_HAS_BEEN_PUSHED
2339   #undef SIGC_NIL_HAS_BEEN_PUSHED
2340   #pragma pop_macro("nil")
2341 #endif
2342 #endif /* _SIGC_FUNCTORS_SLOT_H_ */