RE: [sigc] TypeLists!!!



> -----Original Message-----
> From: Martin Schulze [mailto:martin-ml hippogriff de]
> Sent: Friday, June 11, 2004 11:20 AM
> To: Lemings, Eric B.
> Cc: libsigc++ list
> Subject: Re: [sigc] TypeLists!!!
> 
> 
> Am 11.06.2004 19:01:33 schrieb(en) "Lemings, Eric B.":
> > 
> > All template parameters lists in the API similar to this:
> > 
> >   template
> >   <
> >     class T_type1,
> >     class T_type2,
> >     ...
> >   >
> > 
> > can be replace with one template parameter:
> > 
> >   template
> >   <
> >     typename TList
> >   >
> 
> In public API? Wouldn't this mean that you needed to add an 
> additional  
> keyword to your signal / slot declaration like e.g.:
> 
>   sigc::signal<TList<void,int> > sig1;
> 
> instead of:
> 
>   sigc::signal<void,int> sig1;

Yes, the TYPELIST_N macro.  E.g.,

    sigc::signal<TYPELIST_2(void, int)> sig1;

> IMHO, there is something horribly wrong in your app if you need >5  
> arguments to a function.

Maybe so.  However, such apps do exist.  The Typelist.h header supports
up to 50 parameters!

> This is the reason why using typelists might be desirable. 
> However, I'm  
> afraid the remaining templates would become even harder to read ...
> 
> If it has no other advantage on the public API side apart from being  
> able to specify >7 arguments I'm not in favour of using typelists.

Using typelists in Libsigc++ is just a suggestion.  But consider this:
typelists were created specifically for this type of problem.  Also,
there are many list-like operations that can be performed on typelists
that cannot be performed on template parameter lists with a fixed
number of arguments.  IMHO, the benefits outweigh the drawbacks.  Hence,
the suggestion.

Read the Alexandrescu's chapter in his book before writing them off as
a bad idea.

Eric.



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