home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / cplus / 19915 < prev    next >
Encoding:
Text File  |  1993-01-26  |  961 b   |  24 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!mcsun!dxcern!dxcern!cicci
  3. From: cicci@hpcnnn.cern.ch (Claudio Condini)
  4. Subject: Equivalent of realloc().
  5. Message-ID: <CICCI.93Jan26135919@hpcnnn.cern.ch>
  6. Sender: news@dxcern.cern.ch (USENET News System)
  7. Organization: CERN, European Research Center for Particle Physics
  8. Date: Tue, 26 Jan 1993 12:59:19 GMT
  9. Lines: 13
  10.  
  11.  
  12. I am implementing a class (in fact, a template) Vector which contains a member
  13. function resize(int).  This should really be implemented with a realloc().  Any
  14. constructor for the Element class of Vector should be called for all and only
  15. the new elements.  That is, if I have a vector with 20 elements of class X and
  16. resize it to 30, then the X::X() constructor should be called only for the 10
  17. extra elements, and the original 20 elements should not be touched.  Is there a
  18. way to do this?  I have tried playing with operator new(size_t, void*) but did
  19. not get very far.
  20.  
  21. Regards,
  22.  
  23. Claudio Condini.
  24.