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,887 of 33,346   
   =?UTF-8?B?RGFuaWVsIEtyw7xnbGVy?= to All   
   Re: return type of function or expressio   
   05 Feb 12 06:22:31   
   
   3c3f14c5   
   From: daniel.kruegler@googlemail.com   
      
   Am 05.02.2012 09:28, schrieb Andrzej Krzemieński:   
   > On 4 Lut, 20:31, GH  wrote:   
   >> Hi all, is there a way to statically reference the return type of a   
   >> function or an expression? To make myself clear, take the iomanip   
   >> std::setw for example. The standard explicitly leaves the return type   
   >> of std::setw implementation dependent. Suppose I want to know and   
   >> reference the type of std::setw(8) (e g create a variable of that   
   >> type), is there anyway to reference that type without going to the   
   >> headers and using the implementation dependent type such as std::_Setw   
   >> in g++?   
   >   
   >    decltype(std::setw(8))   
   > or   
   >    std::result_of::type   
      
   Unfortunately the latter won't work, because 'std::setw' does describe a   
   function and not a function object type.   
      
   Technically it would be possible to take advantage of result_of by   
   rewriting this to   
      
   std::result_of::type;   
      
   but then you would still depend on decltype again.   
      
   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