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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,15e41875b75969fc X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wn13feed!worldnet.att.net!bgtnsc05-news.ops.worldnet.att.net.POSTED!53ab2750!not-for-mail Newsgroups: comp.lang.ada From: anon@anon.org (anon) Subject: Re: Dynamically reallocated buffer Reply-To: anon@anon.org (anon) References: <1180679626.254857.59070@w5g2000hsg.googlegroups.com> X-Newsreader: IBM NewsReader/2 2.0 Message-ID: <%HP7i.44715$Sa4.7177@bgtnsc05-news.ops.worldnet.att.net> Date: Fri, 01 Jun 2007 07:15:07 GMT NNTP-Posting-Host: 12.65.78.145 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc05-news.ops.worldnet.att.net 1180682107 12.65.78.145 (Fri, 01 Jun 2007 07:15:07 GMT) NNTP-Posting-Date: Fri, 01 Jun 2007 07:15:07 GMT Organization: AT&T Worldnet Xref: g2news1.google.com comp.lang.ada:16013 Date: 2007-06-01T07:15:07+00:00 List-Id: In <1180679626.254857.59070@w5g2000hsg.googlegroups.com>, Maciej Sobczak writes: >I need a dynamically reallocated buffer of bytes, which I can extend >at run-time by appending new fragments to the whole buffer. The >purpose of the buffer is to pass it later to the subprogram that >writes it "en bloc" to some external device. > >For those of you who know C++ I need something like: > >vector buffer; >// fill the buffer with push_back or insert at end >// ... >write_to_device(&buffer[0], buffer.size()); Stay away from C++. Its the same as a girl on PMS. > >The problem is that Ada.Containers.Vectors does not provide the >necessary guarantees to be any useful in this context. > >What are your suggestions? Did this using Ada 83 for strings vectors for my first class. Which shocked my prof because he said what I had in mine could not be done. The code is at the ACM code server. Using the code it can be modified to work for all Ada packages.