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,503 of 33,346    |
|    =?ISO-8859-1?Q?Daniel_Kr=FCgler?= to All    |
|    Re: Will a const object be moved on retu    |
|    29 Sep 11 16:40:23    |
      From: daniel.kruegler@googlemail.com              Am 29.09.2011 20:02, schrieb Martin B.:       > 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).              This is an interesting idea and looks doable. For copyable types like       strings this would be purely an optimization advantage (but a reasonable       one, don't get me wrong here). Even more interesting is that this would       also work for automatic and const, but move-only objects, e.g. when       using std::unique_ptr as in the following example:              std::unique_ptr |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca