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

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>
Date 2016-03-16 01:07 -0600

Show all headers | 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