🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Array Initialization

#2868
From: John Max Skaller
Date: Wed, 06 Dec 1995 16:03
40 lines
2406 bytes
jbuck@Synopsys.COM (Joe Buck) wrote:
>
>Rohan Lenard asks:
>>> Why is there no auto_array_ptr in the DWP ? Is it an omission or a mistake ?
>
>Nathan Myers <ncm@netcom.com> writes:
>>Neither.  The feeling in the committee was that that would be too close to
>>vector<>.  I.e. when you think you want an auto_array_ptr, consider using
>>a vector<> instead.  
>
>In my humble opinion, this is a mistake; vector<> is a far bigger chunk of
>code than auto_array_ptr<> and supports functionality beyond what a natural
>auto_array_ptr would supply.

Actually, this need not be the case. If you _use_ a vector
"as if" it were a less kind of array type, the code
for the "extra" functionality won't be generated.
If the use is lexically restricted to a block, then
in theory a compiler could optimise vector to work exactly
like a dynamically allocated array.

Remember vector isn't really a template, it's a built in 
structuring tool of the C++ language just like 
"array" or "struct" is.

Don't expect this kind of optimisation right away -- 
we need stable working ISO C++ implementations first.


-- 
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: <4a4cfq$sp8@oznet03.ozemail.com.au>
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage
References: <30B1CB7E.41C67EA6@ecid.cig.mot.com> <48t9t7$5c2@engnews1.eng.sun.com> <199511240018.AA20581@hercules.iassf.easams.com.au> <30BA28C5.50C6@netcom.com> <49gb4c$h5o@hermes.synopsys.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage
From: John Max Skaller <maxtal@suphys.physics.su.oz.au>
Newsgroups: comp.std.c++
Subject: Re: Array Initialization
Date: 6 Dec 1995 16:03:49 GMT
Organization: MAXTAL
Approved: clamage@eng.sun.com (comp.std.c++)
Message-ID: <4a4cfq$sp8@oznet03.ozemail.com.au>
References: <30B1CB7E.41C67EA6@ecid.cig.mot.com> <48t9t7$5c2@engnews1.eng.sun.com> <199511240018.AA20581@hercules.iassf.easams.com.au> <30BA28C5.50C6@netcom.com> <49gb4c$h5o@hermes.synopsys.com>
NNTP-Posting-Host: taumet.eng.sun.com
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"; conversions="7bit"
Content-Transfer-Encoding: 7bit
X-Nntp-Posting-Host: slsyd4p16.ozemail.com.au
X-Mailer: Mozilla 1.2N (Windows; I; 16bit)
X-Lines: 36
Content-Length: 1330
Originator: clamage@taumet