Thread View: comp.std.c++
2 messages
2 total messages
Started by Ilya Vinarsky
Fri, 20 Oct 1995 16:34
new delete where is realloc?
Author: Ilya Vinarsky
Date: Fri, 20 Oct 1995 16:34
Date: Fri, 20 Oct 1995 16:34
10 lines
801 bytes
801 bytes
I could find an answer to this question in the draft std: C++ has operators new and delete, type-safe versions of the old C functions malloc and free. Is there going to be a replacement for realloc? --- [ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu. Contact address: std-c++-request@ncar.ucar.edu. The moderation policy is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Re: new delete where is realloc?
Author: John Max Skaller
Date: Sat, 21 Oct 1995 22:34
Date: Sat, 21 Oct 1995 22:34
26 lines
1709 bytes
1709 bytes
ivin@franklin.CS.Berkeley.EDU (Ilya Vinarsky) wrote:
>
>I could find an answer to this question in the draft std:
>
>C++ has operators new and delete, type-safe versions of the old C functions
>malloc and free. Is there going to be a replacement for realloc?
The easiest way to get this facility is
NOT to use 'new' and 'delete'; use the STL container 'vector'
instead. It reallocates automatically when you insert things.
A closer approximation to the primitive 'realloc'
can be obtained using various STL primitives like
'uninitialised_copy' and managing your own allocations:
have a look at the source code for vector to see how it works.
--
John Max Skaller voice: 61-2-566-2189
81 Glebe Point Rd fax: 61-2-660-0850
GLEBE NSW 2037 email: maxtal@suphys.physics.oz.au
AUSTRALIA email: skaller@maxtal.com.au
---
[ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
Contact address: std-c++-request@ncar.ucar.edu. The moderation policy
is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads