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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,56525db28240414a X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.66.89.196 with SMTP id bq4mr342007pab.26.1343380727747; Fri, 27 Jul 2012 02:18:47 -0700 (PDT) Path: c10ni42362pbw.0!nntp.google.com!news2.google.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Keean Schupke Newsgroups: comp.lang.ada Subject: Re: Efficient Sequential Access to Arrays Date: Fri, 27 Jul 2012 02:17:16 -0700 (PDT) Organization: http://groups.google.com Message-ID: <27ecc562-0882-4fd5-83d4-98ef2f63e6d8@googlegroups.com> References: <01983f1c-f842-4b1f-a180-bcef531dad4c@googlegroups.com> <87ipdf4vh6.fsf@mid.deneb.enyo.de> <4ce44d2d-d789-42a0-a6ed-035f7f8d58be@googlegroups.com> <9c180f15-28b5-46ca-929d-b731058d0a97@googlegroups.com> <1h8xwpi5nyutn$.1odo6yd8h8xhx$.dlg@40tude.net> NNTP-Posting-Host: 82.44.19.199 Mime-Version: 1.0 X-Trace: posting.google.com 1343380727 5078 127.0.0.1 (27 Jul 2012 09:18:47 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 27 Jul 2012 09:18:47 +0000 (UTC) Cc: mailbox@dmitry-kazakov.de In-Reply-To: <1h8xwpi5nyutn$.1odo6yd8h8xhx$.dlg@40tude.net> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=82.44.19.199; posting-account=T5Z2vAoAAAB8ExE3yV3f56dVATtEMNcM User-Agent: G2/1.0 Content-Type: text/plain; charset=ISO-8859-1 Date: 2012-07-27T02:17:16-07:00 List-Id: On Friday, 27 July 2012 09:50:41 UTC+1, Dmitry A. Kazakov wrote: > On Fri, 27 Jul 2012 01:21:18 -0700 (PDT), Keean Schupke wrote: > > > I am wondering if there is a way to use address arithmetic that would be > > just as safe as array indexing? What about something like: > > > > > > type Value_Type is limited private; > > type Index_Type is range <>; > > type Array_Type is array (Index_Type) of Value_Type; type Array_Type is array (Index_Type) of aliased Value_Type; > > > > A : Array_Type; > > > > type Iterator = Address_Integer range A(A'First)'Address .. A(A'Last)'Address step Value_Type'Size; > > > > This would be safe as it could only contain the address of a valid record > > in the array, and the syntax could be neat with automatic dereferencing. > > Value_Type = Boolean Error: array value must be aliased to use iterator. Cheers, Keean. > > -- > Regards, > Dmitry A. Kazakov > http://www.dmitry-kazakov.de