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,226 of 33,346   
   Peter Liedermann to Wil Evers   
   Re: stl clear and erase.   
   01 May 12 06:29:55   
   
   From: peter09876@hispeed.ch   
      
   { Article reformatted -mod }   
      
   On Tue, 01 May 2012 10:34:23 +0200, Wil Evers  wrote:   
      
   > Daniel Kr=FCgler wrote:   
   >   
   >> If you are satisfied with static initial size, std::array is your   
   >> friend. I find it rather amusing to see a comparison of std::array   
   >> with std::vector in this context, because the latter one would be   
   >> the right choice if unknown dynamic size (changes) might occur, so   
   >> is usually orthogonal to the former   
   >   
   > My advice would be to distrust any feeling of satisfaction when   
   > using a container with a size that is fixed at compile time.  In my   
   > experience, such a thing almost always flags some questionable   
   > assumption that will come back to hunt you later.   
   >   
      
   This is generally good advice, especially to those who feel that they   
   do not need it :)   
      
   In my case, however, the size of the structure does not vary with   
   input, but only with certain functional extensions of the code. A   
   fixed size structure could constitute a trap anyway, but there is a   
   specific location in the code to place a sufficient comment.  At the   
   moment, I do not want to use anything which requires C++ 11 for   
   reasons of portability.   
      
   Regards,   
   Peter   
      
      
   --   
         [ 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