[Patch] Use variadic templates for tr1::is_function

Doug Gregor dgregor@cs.indiana.edu
Tue Apr 10 14:07:00 GMT 2007


On Apr 10, 2007, at 8:54 AM, Paolo Carlini wrote:
> I'm finishing regtesting the below, which I consider better than  
> instantiating a lot of templates for a single trait and/or using  
> something like the old __in_array. Do you agree?

Yes, and your improved version (which removes cv-qualifiers) is the  
right way to go.

> Besides that, I'm a little puzzled by this kind of code in tr1/ 
> functional:
>
>  /**
>   * @if maint
>   * Retrieve the result type for a function type.
>   * @endif
>   */
>  template<typename _Res, typename... _ArgTypes>
>    struct _Weak_result_type_impl<_Res(_ArgTypes...)>
>    {
>      typedef _Res result_type;
>    };
>
> and wanted to quickly double check with you that variadic functions  
> are left out on purpose...

It was an oversight. As you know, just adding the following will fix  
this error:

> template<typename _Res, typename... _ArgTypes>
>    struct _Weak_result_type_impl<_Res(_ArgTypes......)>
>    {
>      typedef _Res result_type;
>    };

Sure, you can put a comma between the two ellipses, but it's much  
more amusing to type six periods in a row :)

	Cheers,
	Doug



More information about the Libstdc++ mailing list