0c387f35   
   From: dave@boostpro.com   
      
   on Thu Sep 29 2011, Howard Hinnant wrote:   
      
   > On Sep 29, 2:02 pm, "Martin B." <0xCDCDC...@gmx.at> wrote:   
   >> Isn't this something that could be improved in a future version of the   
   >> standard? C++ already considers a local l-value as an r-value on return,   
   >> wouldn't it make sense to "ignore" the constness? After all, the object   
   >> *is* gonna be destructed right away, and for it's dtor, the constness is   
   >> irrelevant (or so I like to think).   
   >   
   > I think moving from const, even from within a function-local, will   
   > lead to more complicated, more confusion, than is worth the benefit.   
   > Right now the rules are sufficiently simple that almost all cases just   
   > work. The returned-from local is typically not const. And if it is,   
   > just make it non-const and you're good to go. The benefit of moving   
   > from const is low, the cost (in teachability, language complexity) is   
   > not.   
      
   I'm not sure I agree. Why do you think this has high cost to   
   teachability? It's consistent with the rationale for allowing an   
   about-to-be-destroyed object to be moved, so I'd say it fits right in.   
      
   My two concerns are:   
      
   1) it fiddles with the rules for move semantics, and they have not   
    proven to be all that easy to fiddle with without breaking something   
      
   2) it might break existing code.   
      
      
   --   
   Dave Abrahams   
   BoostPro Computing   
   http://www.boostpro.com   
      
      
    [ 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)   
|