Topic: Question about 8.3/10 (function parameter pack)


Author: s.hesp@oisyn.nl ("Sylvester Hesp")
Date: Thu, 24 May 2007 18:39:50 GMT
Raw View
On that same note, 14.5.3/5

--------
template<class ... Args> void g(Args ... args)
{
    f(const_cast<const Args*>(&Args)...);   // OK: "Args" and "args" are
expanded
--------

I think '&Args' should in fact be '&args'.


- Sylvester


"Douglas Gregor" <doug.gregor@gmail.com> wrote in message
news:1179764038.590403.249600@a26g2000pre.googlegroups.com...
> On May 20, 8:12 pm, AlbertoBarb...@libero.it (Alberto Ganesh Barbati)
> wrote:
>> in 8.3/10 of the latest draft (N2289) the example contains:
>
> You mean 8.3.5/10 of N2284, I assume?
>
>>   template<typename... T> void f(T (* ...T)(int, int);
>>
>>   int add(int, int);
>>   float subtract(int, int);
>>   void g() {
>>     f(add, subtract);
>>   }
>>
>> what is the role of the third T in the first line?
>
> Ah, looks like a typo. That was a lower-case 't' in the original
> document. I've reported this problem to the project editor.
>
> Thanks!
>
>  - Doug
>
> ---
> [ comp.std.c++ is moderated.  To submit articles, try just posting with ]
> [ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
> [              --- Please see the FAQ before posting. ---               ]
> [ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]
>


---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]





Author: AlbertoBarbati@libero.it (Alberto Ganesh Barbati)
Date: Mon, 21 May 2007 00:12:23 GMT
Raw View
Hi,

in 8.3/10 of the latest draft (N2289) the example contains:

  template<typename... T> void f(T (* ...T)(int, int);

  int add(int, int);
  float subtract(int, int);
  void g() {
    f(add, subtract);
  }

what is the role of the third T in the first line?

  template<typename... T> void f(T (* ...T)(int, int);
                                         ^
                                         |
                                     this one

If I understand the syntax correctly, after ... we should see the name
of the function parameter pack, so using T seems somehow wrong to me.

Am I missing something?

Ganesh

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]





Author: Douglas Gregor <doug.gregor@gmail.com>
Date: Mon, 21 May 2007 12:06:36 CST
Raw View
On May 20, 8:12 pm, AlbertoBarb...@libero.it (Alberto Ganesh Barbati)
wrote:
> in 8.3/10 of the latest draft (N2289) the example contains:

You mean 8.3.5/10 of N2284, I assume?

>   template<typename... T> void f(T (* ...T)(int, int);
>
>   int add(int, int);
>   float subtract(int, int);
>   void g() {
>     f(add, subtract);
>   }
>
> what is the role of the third T in the first line?

Ah, looks like a typo. That was a lower-case 't' in the original
document. I've reported this problem to the project editor.

Thanks!

  - Doug

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]