home bbs files messages ]

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,346 of 33,346   
   red floyd to PiotrN   
   Re: std::vector: Surprising order of des   
   31 May 12 16:05:29   
   
   1b71ea81   
   From: no.spam.here@its.invalid   
      
   On 5/30/2012 9:20 PM, PiotrN wrote:   
   > Hello,   
   >   
   > I am curious is there any C++ standard rules about destruction of   
   > std::vector elements. For arrays it applies “reverse order” rule –   
   > order of destruction is reverse to elements construction –  and it is   
   > in reverse order of indexes.   
   > It seems, that, for at least one compiler which I tested, the order of   
   > destruction in std::vector is in natural order of indexes, which is   
   > very strange to me!   
   >   
      
   Oddly enough, I couldn't find anything in ISO 14882:2003 that specifies   
   the destruction order of vector elements (I looked at all of Chapter   
   23).  I may have missed something, or it may just be implementation   
   defined, or unspecified (as opposed to undefined) behavior.   
      
   Did they tighten this up in C++11?   
      
      
   --   
         [ 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