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 33,160 of 33,346   
   =?ISO-8859-1?Q?=D6=F6_Tiib?= to All   
   Re: byte buffer implementation   
   04 Aug 13 09:22:49   
   
   From: ootiib@hot.ee   
      
   On Saturday, 3 August 2013 10:50:02 UTC+3, fmatthew5876  wrote:   
   > std::array is just like a struct containing a C array   
   > except that it always initializes its members. This is a slight   
   > but not really problematic inefficiency if you're just   
   > about to write to the buffer.   
      
   std::array is required to be aggregate by standard and so it   
   does not have constructors. If you need to initialize std::array's   
   elements then you have to do it explicitly, for example with   
   aggregate initialization:   
      
     std::array massive = {};   
      
   > std::vector is flexibly growing array that you can append and   
   > insert into forever. If you need this append behavior then use a   
   > vector. If you don't then use one of the other options.   
      
   There are lot more needs/weights to consider when trying to guess an   
   optimal container for particular usage case. In non-waterfall   
   software development process the end needs for a particular   
   container are usually even not fully known when first defining it.   
   To weight the needs one can try to predict future (most can't) or   
   just pick a vector and go on.   
      
   Later when requirements are more clear and there are also samples   
   of actual, non-naive data available to measure the performance then   
   measure and adjust. Commonly it appears that vector is fine on most   
   cases and concerns are elsewhere in that step.   
      
      
   --   
         [ 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