Search code examples
c++templatesc++11g++variadic-templates

g++ std::is_function implementation: what does _ArgTypes followed by 6 periods mean?


I was looking at my headers (g++-4.5.2) for the implementations of some templates in , and I found the following:

/// is_function
template<typename>
  struct is_function
  : public false_type { };
template<typename _Res, typename... _ArgTypes>
  struct is_function<_Res(_ArgTypes...)>
  : public true_type { };
template<typename _Res, typename... _ArgTypes>
  struct is_function<_Res(_ArgTypes......)>
  : public true_type { };

The first two declarations seem reasonable, but I can't figure out how the third works. What is ......? I looked for it in the standard, and couldn't find anything.


Solution

  • It's the same as:

    _Res(_ArgTypes..., ...)
    

    The comma before an ellipses parameter is optional.