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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,64b29dfa2220a59f,start X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!n2g2000hse.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Reserve_Capacity for Unbounded_String? Date: Sun, 22 Jul 2007 12:54:03 -0700 Organization: http://groups.google.com Message-ID: <1185134043.892012.217560@n2g2000hse.googlegroups.com> NNTP-Posting-Host: 85.0.241.122 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-2" X-Trace: posting.google.com 1185134044 12253 127.0.0.1 (22 Jul 2007 19:54:04 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 22 Jul 2007 19:54:04 +0000 (UTC) User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.5) Gecko/20070713 Firefox/2.0.0.5,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: n2g2000hse.googlegroups.com; posting-host=85.0.241.122; posting-account=ps2QrAMAAAA6_jCuRt2JEIpn5Otqf_w0 Xref: g2news1.google.com comp.lang.ada:16534 Date: 2007-07-22T12:54:03-07:00 List-Id: Why there is no Reserve_Capacity for Unbounded_String? Sounds like a natural idea to me. How to emulate it? The following seems to work fine: declare S : Unbounded_String; My_Capacity : constant := 1000; begin S := To_Unbounded_String (My_Capacity); Delete (Source => S, From => 1, Through => My_Capacity); -- ... end; "Seems to work fine" means that after the above two operations the string is logically empty, but the subsequent appends run faster (which is actually the original motivation). Is this a reasonable approach if performance is of concern? -- Maciej Sobczak http://www.msobczak.com/