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,405 of 33,346   
   Dave Harris to Christopher Dearlove   
   Re: std::vector: Surprising order of des   
   12 Jun 12 21:20:43   
   
   913de51d   
   From: brangdon@cix.compulink.co.uk   
      
   christopher.dearlove@googlemail.com (Christopher Dearlove) wrote (abridged):   
   > > What was ill-designed about my code?   
   >   
   > Obviously that it depended on destruction order of a vector.   
      
   So vector doesn't support it because it's bad, and it's bad because   
   vector doesn't support it. I see.   
      
      
   > But that's a symptom of the fact that it's fragile, containing non-   
   > owning pointers that have the potential to bite you hard if not   
   > carefully managed. And putting them in a vector turns out not to   
   > be that.   
      
   The items in the vector don't contain any pointers. Even if they did,   
   non-owning pointers are not intrinsically bad. In this case they are   
   easy to manage, because the item constructor and destructor do all   
   that is required in a well-defined way. The only issues are caused   
   by vector, and would not be issues with a plain C array, or if vector   
   was more consistent with plain C arrays.   
      
   -- Dave Harris, Nottingham, UK.   
      
      
   --   
         [ 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