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-Thread: 103376,fe5e779eaf4ecf02 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news1.google.com!postnews.google.com!s50g2000hsb.googlegroups.com!not-for-mail From: Matthew Heaney Newsgroups: comp.lang.ada Subject: Re: How to loop (elegant) throug a vector ? Date: Mon, 23 Jun 2008 10:14:39 -0700 (PDT) Organization: http://groups.google.com Message-ID: <9c68daa6-a7a2-4c97-8ffd-3b4d75ab1c35@s50g2000hsb.googlegroups.com> References: NNTP-Posting-Host: 66.162.65.129 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1214241279 4982 127.0.0.1 (23 Jun 2008 17:14:39 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 23 Jun 2008 17:14:39 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: s50g2000hsb.googlegroups.com; posting-host=66.162.65.129; posting-account=umyUbgkAAADe5rQC4VzV-ffCoH4N30u3 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; .NET CLR 1.1.4322),gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:826 Date: 2008-06-23T10:14:39-07:00 List-Id: On Jun 20, 3:48=A0pm, Reinert Korsnes wrote: > > for K in X.First_Index .. X.Last_Index loop > =A0 =A0 Do_Something (X.Element (K) ); > end loop; > > Just in case someone in the future change the vector indexing type. > The first element need not correspond to index =3D 1. Right. The first element has index Index_Type'First. You could also say: for K in X.First_Element .. X.Last_Element loop Query_Element (X, K, Do_Something'Access); end loop;