comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.acm.org>
Subject: Re: How to loop (elegant) throug a vector ?
Date: Fri, 20 Jun 2008 23:25:36 GMT
Date: 2008-06-20T23:25:36+00:00	[thread overview]
Message-ID: <Q%W6k.217597$yE1.183725@attbi_s21> (raw)
In-Reply-To: <zrednVKHGcsZlMHVRVnzvQA@telenor.com>

Reinert Korsnes wrote:
> 
> Maybe better:
> 
> for K in X.First_Index .. X.Last_Index loop
>     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 = 1.

The 1st index is always Index_Type'First. It hasn't been my experience that 
index subtypes change much, but I suppose this is closer to A'range.

-- 
Jeff Carter
"I spun around, and there I was, face to face with a
six-year-old kid. Well, I just threw my guns down and
walked away. Little bastard shot me in the ass."
Blazing Saddles
40



  reply	other threads:[~2008-06-20 23:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-20 13:19 How to loop (elegant) throug a vector ? Reinert Korsnes
2008-06-20 14:49 ` Pascal Obry
2008-06-20 17:12 ` Returning ranges from a function (was: How to loop (elegant) throug a vector ?) Stefan Bellon
2008-06-22 14:01   ` Maciej Sobczak
2008-06-22 18:47     ` Stefan Bellon
2008-06-22 21:06       ` Maciej Sobczak
2008-06-23  9:47         ` Stefan Bellon
2008-06-23 12:06           ` Maciej Sobczak
2008-06-23 12:28             ` christoph.grein
2008-06-20 19:21 ` How to loop (elegant) throug a vector ? Jeffrey R. Carter
2008-06-20 19:48   ` Reinert Korsnes
2008-06-20 23:25     ` Jeffrey R. Carter [this message]
2008-06-23 17:14     ` Matthew Heaney
2008-06-23 17:11   ` Matthew Heaney
2008-06-23 17:08 ` Matthew Heaney
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox