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,102 of 33,346   
   =?ISO-8859-1?Q?Daniel_Kr=FCgler?= to All   
   Re: trouble with decltype   
   06 Apr 12 17:55:16   
   
   37e5289f   
   From: daniel.kruegler@googlemail.com   
      
   Am 06.04.2012 21:55, schrieb Brendan:   
   > I'm getting some weird behavior from decltype, at least on my compiler   
   > (g++ 4.6). Could someone explain whether this is standard and why?   
   >   
   > Consider:   
   >   
   > std::vector  vec;   
   > decltype(vec)::value_type x;   
   >   
   > The second line gives me the error:   
   > expected initializer before "x"   
   >   
   > I'm not sure what that means in this context. I'd expect my decltype   
   > code to be the same as:   
   >   
   > std::vector::value_type x;   
   >   
   > Is :: prohibited to be used with decltype? If so, what's the best   
   > workaround?   
      
   Originally decltype was not allowed in this context, but is was made   
   possible after declaring   
      
   http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#743   
      
   as a defect. Newer versions of gcc accept the code as they should.   
      
   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