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,069 of 33,346   
   red floyd to Nikolay Ivchenkov   
   Re: Pack expansion vs multiple parameter   
   29 Mar 12 21:17:40   
   
   bb2439ee   
   From: no.spam.here@its.invalid   
      
   On 3/29/2012 2:05 PM, Nikolay Ivchenkov wrote:   
   > It seems that the following code should be well-formed   
   >   
   >      template   
   >          struct X   
   >      {   
   >          typedef typename X::type type;   
   >      };   
   >   
   >      template   
   >          struct X   
   >      {   
   >          typedef void type;   
   >      };   
   >   
   >      int main() {}   
   >   
   > However, GNU C++ 4.8.0, Clang 3.0, and Intel C++ 12.1 issue errors at   
   > line 4:   
   >   
   > GNU C++ 4.8.0:   
   >      error: wrong number of template arguments (1, should be 2 or more)   
   >   
   > Clang 3.0:   
   >      error: too few template arguments for class template 'X'   
   >      typedef typename X::type type;   
   >                       ^   
   > Intel C++ 12.1:   
   >      error: too few arguments for class template "X"   
   >      typedef typename X::type type;   
   >                                 ^   
   >   
   > Is there any reason why such a code should be rejected?   
   >   
   >   
      
      
   Don't specialize at line 4.  Just make it a new template.   
      
   template   
        struct X   
   {   
        typedef void type;   
   };   
      
      
   --   
         [ 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