GNU bug report logs -
#23610
25.0.94; c++-mode doesn't fontify typename... like typename
Previous Next
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
Message #14 received at 23610 <at> debbugs.gnu.org (full text, mbox):
Hello, Óscar.
Thanks for your post!
On Mon, May 30, 2016 at 03:49:57PM +0200, Óscar Fuentes wrote:
> 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"?
> Neither, 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':
I thought there might be something like that. ;-)
> template <typename ... Ts> struct Foo {
> void print() {
> printf("Instantiated 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
That looks like exactly what I need. Thanks very much!
--
Alan Mackenzie (Nuremberg, Germany).
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.