Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!zaphod.mps.ohio-state.edu!mips!pacbell.com!pacbell!att!dptg!pegasus!hansen From: hansen@pegasus.ATT.COM (Tony L. Hansen) Newsgroups: comp.lang.c++ Subject: Re: delete [] Keywords: arrays, new&delete Message-ID: <4953@pegasus.ATT.COM> Date: 2 Aug 90 20:20:51 GMT References: <641@atcmpe.atcmp.nl> <1990Jul27.231220.8396@cerc.utexas.edu> <4937@pegasus.ATT.COM> <4942@pegasus.ATT.COM> <1568@idunno.Princeton.EDU> Reply-To: hansen@pegasus.ATT.COM (Tony L. Hansen) Organization: AT&T Bell Labs NJ USA Lines: 22 < From: ssr@taylor.Princeton.EDU (Steve S. Roy) < In article <4942@pegasus.ATT.COM> hansen@pegasus.ATT.COM (Tony L. Hansen) writes: << "X *x = new X[m]" means to allocate an array of objects of type X, using << only the global operator ::new(), invoke the appropriate constructor for << x[0] through x[m-1], and assign a pointer to the array to the pointer x. << The 1990 definition of C++ also mandates that the C++ environment << remember the value m associated with that pointer. < < Sorry, but I don't have docs for 2.1 available. Is there any way for me < to get at the size of that array without remembering it thru my code? < That way I could, say, iterate over all elements of the array without < having a stupid variable like n_x around. I don't believe that there's such a requirement at this time. An implementation is free to provide a method of accessing that number, but I don't think that 2.1 does. Sorry. You can always propose such a requirement within comp.std.c++. Tony Hansen att!pegasus!hansen, attmail!tony hansen@pegasus.att.com