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