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 31,886 of 33,346   
   =?windows-1252?Q?Daniel_Kr=FCgler?= to All   
   Re: could not deduce template argument f   
   05 Feb 12 06:22:09   
   
   a620e3f0   
   From: daniel.kruegler@googlemail.com   
      
   Am 05.02.2012 09:30, schrieb Helmut Zeisel:   
   > On 1 Feb., 19:29, Helmut Jarausch   
   > wrote:   
   >   
   >> I'd use the new std::array.   
   >   
   > How can I initialize 2-dim std::array?   
   >   
   > std::array,2>  a={{1,2},{3,4}};   
      
   Unfortunately you need one further pair of braces for each array level,   
   ending in   
      
   std::array,2> a={{ {{1,2}}, {{3,4}} }};   
      
   This is so, because the simple initialization of std::array with a   
   single pair of braces relies on one very special rule of aggregate   
   initialization that allows elision of braces under a very restricted set   
   of circumstances. Technically you could satisfy this condition by   
   rewriting above to   
      
   std::array,2> a={ std::array{{1,2}},   
   std::array{{3,4}} };   
      
   but this is obviously worse compared to the alternative mentioned above.   
      
   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