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:05:15 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!sn-xit-03!sn-xit-01!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:04:04 -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:29462 Date: 2002-10-02T11:04:04-04:00 List-Id: "Nacho" wrote in message news:am26u4$d2q$1@nsnmpen2-gest.nuria.telefonica-data.net... > I am learning ada and i have to implement an array of unknown size until > rutime. > The array must be resizable at runtime. This is easy to achieve for me in > other lenguajes like c++, but i am new to ada and i don't know hot to > resolve the problem. The solution in c++ code could be: [snipped] > How can I do the same in ada? > How can I use dinamics arrays of variable size in ada? The Charles container library comes with a vector data structure that does this sort of thing, e.g. package Integer_Vectors is new Charles.Vectors.Unbounded (Integer); subtype Vector_Subtype is Integer_Vectors.Container_Type; use Integer_Vectors; V : Vector_Subtype := To_Container (Length => 50); ... V := To_Container (Length => 80); --or-- Assign (V, Length => 80); If you're comfortable with the C++ STL, then using Charles will be natural. http://home.earthlink.net/~matthewjheaney/charles/index.html There's also a deque container type, which allows insertions at the front of the container.