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,500 of 33,346    |
|    Ivan Godard to Kaba    |
|    Re: Why doesn't push_back return an iter    |
|    24 Jul 12 18:05:41    |
      From: igodard@pacbell.net              On 7/24/2012 12:28 PM, Kaba wrote:       > 24.7.2012 21:53, Bo Persson kirjoitti:       >> Because it isn't very useful, and you already know exactly where the       >> new element will end up: list.back()       >       > On the usefulness I disagree (see my other posts); on my viewpoint an       > element is very often created to be referred to directly, not just as       > a member of sequence.       >       > It is true that we know were the element is, but I don't accept this       > as a convincing argument why things should be this way:)       >       >> If you want an iterator anyway, you can easily get one with       >>       >> list.insert(list.cend(), Value);       >       > This is a practical option.       >       Only if the list is not shared among threads. The STL will make each       operation atomic, but not two together. Consequently the insert may not       be at the end. Worse, list.cend may be invalidated by the time       list.insert happens. The proposal avoids that problem.              Ivan                     --        [ 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