unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: "Óscar Fuentes" <ofv@wanadoo.es>
Cc: Ivan Andrus <darthandrus@gmail.com>, 23610@debbugs.gnu.org
Subject: bug#23610: 25.0.94; c++-mode doesn't fontify typename... like typename
Date: Mon, 30 May 2016 15:25:39 +0000	[thread overview]
Message-ID: <20160530152538.GA3629__4518.12878386608$1464622033$gmane$org@acm.fritz.box> (raw)
In-Reply-To: <87oa7nbqpm.fsf@wanadoo.es>

Hello, Óscar.

Thanks for your post!

On Mon, May 30, 2016 at 03:49:57PM +0200, Óscar Fuentes wrote:
> Hello Alan.

> Alan Mackenzie <acm@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).





  reply	other threads:[~2016-05-30 15:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-24 17:01 bug#23610: 25.0.94; c++-mode doesn't fontify typename... like typename Ivan Andrus
     [not found] ` <mailman.202.1464109329.1216.bug-gnu-emacs@gnu.org>
2016-05-30 12:57   ` Alan Mackenzie
2016-05-30 13:49     ` Óscar Fuentes
2016-05-30 15:25       ` Alan Mackenzie [this message]
2016-07-23 15:13     ` Alan Mackenzie
2016-06-19 21:14   ` Alan Mackenzie
2016-06-22 15:22     ` Ivan Andrus
2016-06-30 14:36       ` Alan Mackenzie
2016-06-30 15:10         ` John Yates
2016-06-30 16:47           ` Alan Mackenzie
2016-06-30 17:24       ` Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='20160530152538.GA3629__4518.12878386608$1464622033$gmane$org@acm.fritz.box' \
    --to=acm@muc.de \
    --cc=23610@debbugs.gnu.org \
    --cc=darthandrus@gmail.com \
    --cc=ofv@wanadoo.es \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).