From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,71c743c03ed191fe X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-10-02 08:14:33 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!sn-xit-03!sn-xit-06!sn-post-02!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: "Matthew Heaney" Newsgroups: comp.lang.ada Subject: Re: Beginer problem: variable array size Date: Wed, 2 Oct 2002 11:13:57 -0400 Organization: Posted via Supernews, http://www.supernews.com Message-ID: References: X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Complaints-To: abuse@supernews.com Xref: archiver1.google.com comp.lang.ada:29464 Date: 2002-10-02T11:13:57-04:00 List-Id: "Robert A Duff" wrote in message news:wccd6ran71c.fsf@shell01.TheWorld.com... > > It's usually better to allocate exponentially-more space each time a > reallocate-and-copy is needed. The C++ STL and Ada95 Charles libraries both work by multiplying the current length of the underlying array by a factor of 2, and using that as the length of the new internal array when reallocating. http://home.earthlink.net/~matthewjheaney/charles/index.html In Charles, Size returns the length of the internal array, and Resize can be used to set the value explicitly. (These are exactly equivalent to the Capacity and Reserve member functions of the STL vector class.)