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 33,094 of 33,346   
   =?ISO-8859-1?Q?=D6=F6_Tiib?= to Chris Vine   
   Re: template virtual methods   
   26 May 13 22:19:18   
   
   From: ootiib@hot.ee   
      
   On Monday, 27 May 2013 04:23:17 UTC+3, Chris Vine  wrote:   
     > On Sun, 26 May 2013 00:05:29 -0700 (PDT)   
     > Öö Tiib  wrote:   
     > > My bet goes to complexity and no gain. Can you provide example for   
     > > what to use such a thing? I can't (so "no gain" part is just maybe   
     > > my bad imagination).   
     >   
     > Yes, you can't do perfect forwarding of arguments with virtual   
     > functions, as forwarding requires the argument type to be templated.   
     > You end up passing class types by reference to const, which   
     > eliminates the possibility of moving a temporary.   
      
   Aren't rvalue references meant for temporaries? AFAIK those do not   
   have to reference templated types and may well be parameters (or   
   return values) of virtual member functions. I would use a pair of   
   virtual overloads instead of a virtual template in such context   
   because those feel less complex.   
      
      
   --   
         [ 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