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


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

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

Path csiph.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!Xl.tags.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date Wed, 16 Mar 2016 01:10:13 -0500
Return-Path <cppmods@glengoyne.dreamhost.com>
Sender std-cpp-request@vandevoorde.com
Approved austern@google.com
Message-ID <dj34g7Fg4tqU1@mid.individual.net> (permalink)
Newsgroups comp.std.c++
From Christoph Schulz <develop@kristov.de>
Subject Re: C++11: Template argument deduction, partial ordering, and trailing parameter packs
Organization unknown
References <dijkrvFh6ulU1@mid.individual.net>
Content-Type text/plain; charset="UTF-8"
X-Original-Date Tue, 23 Feb 2016 14:17:59 +0100
X-Submission-Address std-cpp-submit@vandevoorde.com
Date Wed, 16 Mar 2016 01:07:54 CST
Lines 41
X-Usenet-Provider http://www.giganews.com
X-Trace sv3-ZBKqOWb5W/yBCVmb4nS9rQhr36rQr7dKj2yGGkI43ju+djQxxzPbfmqMqkI8CvFNdtV36q05mEpBvQw!G753ZrBGx62yhzKHiaf1Vd+DJGrJpDReKktDeYrdxNRNOac2DkWSClGAGEQ=
X-Complaints-To abuse@giganews.com
X-DMCA-Notifications http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info Otherwise we will be unable to process your complaint properly
X-Postfilter 1.3.40
X-Original-Bytes 2386
X-Received-Bytes 2498
X-Received-Body-CRC 1222891135
Xref csiph.com comp.std.c++:787

Show key headers only | View raw


Hello!

Christoph Schulz wrote:

> Hello,
>
> I read §14.8.2.1, §14.8.2.4, and §14.8.2.5 multiple times but did not find
> a convincing argumentation why the second of the following two function
> templates is more specialized for the given argument than the first one:
> [...]

I just learned that clang++ (version 3.7.0) barks at the code:

main.cpp:21:18: error: call to 'f' is ambiguous
    std::cout << f(X<1>{}) << std::endl; // selects #2
                 ^
main.cpp:9:5: note: candidate function [with I = 1, Ints = <>]
int f(X<I, Ints...> x) {
    ^
main.cpp:15:5: note: candidate function [with I = 1]
int f(X<I>) {
    ^
1 error generated.

Perhaps my assumption that this code is ambiguous is indeed correct.
Nevertheless I would like to see it confirmed by some other C++ expert(s)
;-)


Best regards,

--
Christoph Schulz


[ 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 | 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