🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #2272

Re: new delete where is realloc?

#2272
From: John Max Skaller
Date: Sat, 21 Oct 1995 22:34
26 lines
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. ]
Technical Details
Message-ID: <46agu0$lro@oznet07.ozemail.com.au>
Path: arc1-ca.pugleaf.net!in1.uu.net!bounce-back
References: <46797p$649@agate.berkeley.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!in1.uu.net!bounce-back
Date: 21 Oct 95 22:34:58 GMT
Approved: fjh@cs.mu.oz.au
From: John Max Skaller <maxtal@suphys.physics.su.oz.au>
Newsgroups: comp.std.c++
Subject: Re: new delete where is realloc?
X-Original-Date: 21 Oct 1995 10:10:08 GMT
Organization: MAXTAL
Message-ID: <46agu0$lro@oznet07.ozemail.com.au>
References: <46797p$649@agate.berkeley.edu>
X-Mailer: Mozilla 1.2N (Windows; I; 16bit)
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBFAgUBMIl1reEDnX0m9pzZAQFyCgF+J0pPowH9hzNlajW3zMT3r5sdG0TUnDsu
 4BJJia/dJitDI3rskuxNDT6hBFUgcUFF
 =aYR5