-september.org> 9e4066b2   
   From: leigh@i42.co.uk   
      
   On 26/03/2013 10:38, Tobias Müller wrote:   
   >   
   > Leigh Johnston wrote:   
   >> On 25/03/2013 20:45, Tobias M�ller wrote:   
   >>>   
   >>> Leigh Johnston wrote:   
   >>>> On 25/03/2013 16:40, goran.pusic@googlemail.com wrote:   
   >>>>> Erm... I don't understand why is portability affected by what   
   >>>>> clear() does behind the scenes.   
   >>>>   
   >>>> To see how it might affect portability consider how reallocations   
   >>>> invalidate iterators and element references.   
   >>>   
   >>> Iterators and references to elements of an _empty_ vector? What are   
   >>> they good for?   
   >>   
   >> If you call push_back() multiple times on a vector element   
   >> references and iterators remain valid if capacity remains unchanged.   
   >   
   > Sure, but we are talking about clear(), not push_back(). After a call   
   > to clear(), the vector is empty, that means no element exist. So all   
   > references and iterators are invalid (dangling) anyway.   
      
   We are talking about calling push_back() *after* calling clear(). We   
   are talking about wanting a vector's capacity to be *unchanged* after   
   calling clear().   
      
   /Leigh   
      
      
   --   
    [ 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)   
|