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 31,511 of 33,346   
   Miles Bader to nmm1@cam.ac.uk   
   Re: Using the STL for scientific program   
   30 Sep 11 22:12:54   
   
   From: miles@gnu.org   
      
   nmm1@cam.ac.uk writes:   
   > But do those really help compared with rolling your own?  My point is   
   > not that they don't work, but what practical benefits they convey.   
      
   Isn't "not needing to roll your own" a pretty significant benefit?   
      
   > When writing classes that needed vectors, I discovered that using   
   > std::vector didn't simplify the code significantly over ordinary   
   > arrays/pointers or provide significant extra checking.  It does free   
   > space when writing a simple vector declaration and using exceptions to   
   > jump out, but that's about all I found.   
      
   Er, but that's actually very useful...   
      
   Even if you're not really using the typical std::vector funtionality   
   like resizability, iterator functions, etc, it's a great default way to   
   allocate memory.  Even for this simple functionality, it can cut out a   
   lot of boilerplate, and increase safety (since any time you use   
   boilerplate, there's a chance to mess it up)...   
      
   [E.g., you write a matrix class, you need memory for the contents,   
   right?  Why not use a std::vector?]   
      
   -Miles   
      
   --   
   97% of everything is grunge   
      
      
         [ 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