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,956 of 33,346   
   Andy Champ to A. McKenney   
   Re: Sequence container capacity after ca   
   29 Mar 13 23:49:14   
   
   d662a69b   
   From: no.way@nospam.invalid   
      
   On 29/03/2013 20:29, A. McKenney wrote:   
   > If we knew the maximum size in advance (=at development time), the   
   > problem would be trivial.  In many cases, normal C arrays would be   
   > fine.   
   >   
   > What we're trying to get away from is having to guess at a reasonable   
   > (less then 2Gb:-)  ) upper bound on the size and hoping we don't ever   
   > have to   
   > deal with data longer than that.  And from the performance hit of   
   > heap storage for function-local data.   
      
   A _lot_ less than 2Gb. That 2Gb has to have your code, heap and stack -   
   if you are on a 32-bit machine. (on 64-bit, all bets are off)   
      
   Can't you allocate the array once (as a std::vector) then pass   
   references to it around the place?   
      
   Andy   
      
      
   --   
         [ 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