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 32,323 of 33,346    |
|    Seungbeom Kim to Wil Evers    |
|    Re: Broken interaction between std::prio    |
|    22 May 12 11:38:24    |
      From: musiphil@bawi.org              On 2012-05-21 14:24, Wil Evers wrote:       > Seungbeom Kim wrote:       >> On 2012-05-20 21:19, Zoltan Juhasz wrote:       >>> The pop( value_type& e ), on the other hand, does not suffer from       >>> these kind of problems;       >>       >> But then you need to default construct an object of value_type and       >> ask the top element to be move-assigned to it. It may not be always       >> possible or desirable to default construct such an object, just to       >> be overwritten later.       >       > I agree. Paradoxically, a movable type without a default       > constructor seems like a strange beast, because it presumably       > implements a "valid, but resourceless" state for its objects to be       > left in after having been moved from.       >       > I would say that a type with a default constructor clearly       > advertises that such a state exists and must be reckoned with.              You have a good point. Then in most sensible cases, the default       constructor should be available and its cost should reduce to       initializing a few small scalar objects such as pointers or booleans.              The remaining problem is that of aesthetics: "value_type e = q.pop();"       is much more elegant than "value_type e; q.pop(e);" and I'd love to be       able to write so.              --       Seungbeom Kim                      [ 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