This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch] Use variadic templates for tr1::is_function



On Apr 10, 2007, at 3:57 PM, Paolo Carlini wrote:


... but then why we have:

 /**
  * @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;
   };

in the first place? Does it ever trigger? (Still, the other specializations, for function pointers and references, should be added of a version for variadic functions, I think)

_Weak_result_type_impl is used directly from _Weak_result_type, like this:


  /**
   * @if maint
   * We already know the result type for @c Functor; use it.
   * @endif
   */
  template<typename _Functor, typename... _ArgTypes>
    struct _Result_of_impl<true, _Functor(_ArgTypes...)>
    {
      typedef typename _Weak_result_type<_Functor>::result_type type;
    };

So, we end up stripping off the argument types (_Argtypes...) that are passed to the _Functor, and only _Functor gets passed on to _Weak_result_type_impl.

	Cheers,
	Doug


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]