home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c++.moderated      Moderated discussion of C++ superhackery      33,346 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 32,735 of 33,346   
   =?ISO-8859-1?Q?Daniel_Kr=FCgler?= to All   
   Re: Why is this ambiguous? (Variadic tem   
   15 Dec 12 10:21:40   
   
   From: daniel.kruegler@googlemail.com   
      
   Am 15.12.2012 01:33, schrieb Scott Prager:   
   > In section 14.5.6.2 of the standard, it shows an example like this:   
   >   
   > template void f(T, U...);   
   > template void f(T);   
   >   
   > void g( int i ) {   
   >      f(&i); // ambiguous   
   > }   
   >   
   > Why is the overload without the empty parameter pack not preferred?   
      
   The reasoning was based on the comparison with ellipses or function   
   default arguments such as in the following example:   
      
   template void f(T);   
   template void f(T, int=1);   
   template void g(T);   
   template void g(T, ...);   
      
   int main() {   
     int i = 42;   
     f(i);          // Error: ambiguous   
     g(i);          // Error: ambiguous   
   }   
      
   Arguably there exists now a consistency argument here when referring to   
   empty parameter packs. Question is whether Parameter packs resemble   
   sufficiently with the former two function forms in this regard.   
      
   > This has bugged me for as long as I've known of it.   
      
   You are not the first one. The current state has lead to new CWG issues, see   
      
   http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1395   
   http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1432   
      
   There is some tendency that the current ambiguity rule in regard to   
   parameter packs could be changed to support your use-case.   
      
   HTH & Greetings from Bremen,   
      
   Daniel Krügler   
      
      
   --   
         [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
         [ comp.lang.c++.moderated.    First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca