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,779 of 33,346    |
|    Marc to mike    |
|    Re: decltype and reference parameter    |
|    05 Jan 12 13:16:24    |
   
   63b74654   
   From: marc.glisse@gmail.com   
      
   mike wrote:   
      
   > Hi All, please consider the following simple snippet:   
   >   
   > #include    
   > #include    
   >   
   > struct Functor {   
   > typedef int type;   
   > int operator()(int t) {return t;}   
   > // int operator()(int& t) {return t;}   
   > };   
   >   
   > template    
   > struct RetType {   
   > typedef typename Func::type param_type;   
   > typedef decltype(Func().operator()(std::declval()))   
   > ret_type;   
   > };   
   >   
   > int main() {   
   > RetType::ret_type i = 1;   
   > }   
   >   
   > I am struggling to modify decltype within the RetType struct to work   
   > with the second version of Functor::operator() call where parameter   
   > is passed by reference.   
   > Any help is greatly appreciated.   
      
   std::declval   
   ?   
      
      
   --   
    [ 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