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,514 of 33,346   
   Kaba to All   
   Re: Return-type deduction for all functi   
   11 Aug 12 12:17:29   
   
   From: kaba@nowhere.com   
      
   11.8.2012 9:14, Francis Glassborow kirjoitti:   
   > On 10/08/2012 22:35, Kaba wrote:   
   >> 10.8.2012 21:19, Francis Glassborow kirjoitti:   
   >>> On 09/08/2012 19:51, Kaba wrote:   
   >>>> Would it make sense to generalize the implicit return-type   
   >>>> deduction of the lambda functions to all functions? Motivation:   
   >>>> reading the Boost.Proto documentation and seeing something like   
   >>>> this:   
   >>>>   
   >>> But the problem is that only a function declaration is needed in   
   >>> order to call a function. How will the caller know what the return   
   >>> type is?   
   >   
   > template g(T t);   
   >   
   > int main(){   
   >      g(f());  // how is the compiler to deal with this?   
   > // ...   
   > }   
      
   I see. Then one would need to add the requirement that a function with   
   the implicit-return type has to be defined before its return-type is   
   queried. In this case, emit "error: Unable to deduce the return-type of   
   the function template  g(T t), where T = ".   
   Lambdas are able to avoid this problem because they can never be   
   forward-declared.   
      
   --   
   http://kaba.hilvi.org   
      
      
         [ 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