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,034 of 33,346    |
|    =?ISO-8859-1?Q?Daniel_Kr=FCgler?= to All    |
|    Re: automatic return-type deduction for     |
|    20 Mar 12 22:37:20    |
   
   7cf909a7   
   From: daniel.kruegler@googlemail.com   
      
   Am 20.03.2012 09:29, schrieb Jens Auer:   
   > I would even go further and let the return type deduced when the   
   > lambda contains multiple returns with the same type, e.g. an if   
   > statement:   
   > auto max = [](int x, int y)   
   > {   
   > if ( x> y )   
   > {   
   > return x;   
   > }   
   > else   
   > {   
   > return y;   
   > }   
   > }   
   >   
   > Why not have the return type automatically deduced from all return   
   > statements as long as there is no ambiguity? The compiler computes the   
   > type of all return statements anyway when we specify a return type to   
   > check the type.   
      
   Yes, this exactly the solution that is suggested by:   
      
   http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#975   
      
   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