home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!ames!agate!dog.ee.lbl.gov!news!vela!cs.uiuc.edu!sparc0b!pjl
- From: pjl@cs.uiuc.edu (Paul Lucas)
- Subject: Re: Equivalent of realloc().
- Message-ID: <C1Irw4.Is3@cs.uiuc.edu>
- Sender: news@cs.uiuc.edu
- Organization: University of Illinois at Urbana-Champaign
- References: <CICCI.93Jan26135919@hpcnnn.cern.ch>
- Date: Wed, 27 Jan 1993 15:48:03 GMT
- Lines: 20
-
- In <CICCI.93Jan26135919@hpcnnn.cern.ch> cicci@hpcnnn.cern.ch (Claudio Condini) writes:
-
- >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.
-
- There's no equivalent to realloc().
-
- See: Tom Cargill, "A Dynamic Vector Is Harder Than It Looks,"
- C++ Report. It was one of the issues during summer '92
- (I can't remember which).
- --
- - Paul J. Lucas
- AT&T Bell Laboratories
- Naperville, IL
-