GNU bug report logs - #23610
25.0.94; c++-mode doesn't fontify typename... like typename

Previous Next

Packages: cc-mode, emacs;

Reported by: Ivan Andrus <darthandrus <at> gmail.com>

Date: Tue, 24 May 2016 17:02:02 UTC

Severity: minor

Found in version 25.0.94

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Óscar Fuentes <ofv <at> wanadoo.es>
To: Alan Mackenzie <acm <at> muc.de>
Cc: Ivan Andrus <darthandrus <at> gmail.com>, 23610 <at> debbugs.gnu.org
Subject: bug#23610: 25.0.94; c++-mode doesn't fontify typename... like typename
Date: Mon, 30 May 2016 15:49:57 +0200
Hello Alan.

Alan Mackenzie <acm <at> muc.de> 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




This bug report was last modified 8 years and 307 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.