Re: [sigc] Template mystery



>The list being the point where this all comes to a head I suppose.

not if you start with a pure virtual parent for slot, one which
contains a void method to invoke it:

     template struct abstract_slot {
         virtual void call () = 0;
     }
      
and then make:

     template struct slot<class ReturnType> : public abstract_slot<ReturnType> {
         void call() { (void) operator() (); }
	 ...
     }

your list is then
 
     list<abstract_slot>

and invoking the list of slots is just:

     for (i = slots.begin(); i != slots.end(); ++i) {
          (*i)->call ();
     }

this is not actually how sigc++ does it, but conceptually its
close. more sophistication is required to add semantics to the slots'
operator() return values.

--p



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