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,511 of 33,346   
   Kaba to All   
   Return-type deduction for all functions   
   09 Aug 12 11:51:49   
   
   From: kaba@nowhere.com   
      
   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:   
      
   template< int Exp, typename Arg >   
   typename proto::result_of::make_expr<   
         proto::tag::function  // Tag type   
       , pow_fun< Exp >        // First child (by value)   
       , Arg const &           // Second child (by reference)   
     >::type const   
   pow(Arg const &arg)   
   {   
         return proto::make_expr(   
             pow_fun()    // First child (by value)   
           , boost::ref(arg)   // Second child (by reference)   
         );   
   }   
      
   I wish I could do it like this:   
      
   template< int Exp, typename Arg >   
   auto pow(Arg const &arg)   
   {   
         return proto::make_expr(   
             pow_fun()    // First child (by value)   
           , boost::ref(arg)   // Second child (by reference)   
         );   
   }   
      
   decltype does not help much here either...   
      
   --   
   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