Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.std.c++ > #784

Re: C++11: Template argument deduction, partial ordering, and trailing parameter packs

Message-ID <slrnnck9d4.1ic.cmeerw@msgid.cmeerw.org> (permalink)
Newsgroups comp.std.c++
From Christof Meerwald <NOSPAM-seeMySig+ul15+@usenet.cmeerw.org>
Subject Re: C++11: Template argument deduction, partial ordering, and trailing parameter packs
Organization Hacking@Home
References <dijkrvFh6ulU1@mid.individual.net>
Date 2016-03-16 01:07 -0600

Show all headers | View raw


On Sat, 20 Feb 2016 15:19:09 CST, Christoph Schulz wrote:
>========= %< =========
> #include <ostream>
> #include <iostream>
>
> template<int ...T>
> struct X {};
>
> // #1
> template<int I, int ...Ints>
> int f(X<I, Ints...> x) {
>         return I + f(X<Ints...>{});
> }
>
> // #2
> template<int I>
> int f(X<I>) {
>         return I;
> }
>
> int main()
> {
>         std::cout << f(X<1>{}) << std::endl; // selects #2
> }
>========= %< =========

Isn't that kind of what core issues 1395
http://wg21.cmeerw.net/cwg/issue1395 and 1432
http://wg21.cmeerw.net/cwg/issue1432 are about?

g++ is likely implementing the proposed resolution, but that
resolution hasn't been incorporated into the standard text yet.


Christof


--
http://cmeerw.org                              sip:cmeerw at cmeerw.org
mailto:cmeerw at cmeerw.org                   xmpp:cmeerw at cmeerw.org


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

Back to comp.std.c++ | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

C++11: Template argument deduction, partial ordering, and trailing parameter packs Christoph Schulz <develop@kristov.de> - 2016-02-20 15:19 -0600
  Re: C++11: Template argument deduction, partial ordering, and  trailing parameter packs Christof Meerwald <NOSPAM-seeMySig+ul15+@usenet.cmeerw.org> - 2016-03-16 01:07 -0600
  Re: C++11: Template argument deduction, partial ordering, and trailing parameter packs Christoph Schulz <develop@kristov.de> - 2016-03-16 01:07 -0600

csiph-web