Subject: Re: bug#23610: 25.0.94; c++-mode doesn't fontify typename... like typename

From: Óscar Fuentes <[email-masked]>
Date: Mon, 30 May 2016 15:49:57 +0200

Hello Alan.

Alan Mackenzie <[email-masked]> writes:

> I'm not all that familiar with variadic templates.  In the declaration
> below, is the "..." token syntactically part of "typename..." or is
> better regarded as part of "... Y"?

Neiter, I'll say.

It is legal to omit the name of the parameter pack (the `Y' in the
example).

> I also need to get a feel for what keywords can come before the "...".
> Obviously "typename", but what about things like "class"?

Yes, `class' and `typename' are interchangeable here. There is also
`sizeof':

template <typename ... Ts> struct Foo {
  void print() {
    printf("Intantiated with %d parameters.\n", sizeof...(Ts));
  }
};

int main() {
  Foo<int, double> foo;
  foo.print();
  return 0;
}

Prints

Intantiated with 2 parameters.

> Do you know of a good web page where these things are explained
> completely and concisely, yet readably?  If so, please tell me!

Try this, which is short and precise:

http://en.cppreference.com/w/cpp/language/parameter_pack