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.4 required=5.0 tests=BAYES_00,FORGED_MUA_MOZILLA autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,7b6305d0d57a9f34 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,UTF8 Received: by 10.68.19.161 with SMTP id g1mr5348564pbe.7.1319873407519; Sat, 29 Oct 2011 00:30:07 -0700 (PDT) Path: p6ni20746pbn.0!nntp.google.com!news1.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!193.252.117.184.MISMATCH!feeder.news.orange.fr!not-for-mail Date: Sat, 29 Oct 2011 09:29:13 +0200 From: Pascal Obry Organization: Home - http://www.obry.net User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; fr-FR; rv:1.8.1.22) Gecko/20090605 Thunderbird/2.0.0.22 Mnenhy/0.7.5.0 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Normalizing array indices References: In-Reply-To: Message-ID: <4eabab47$0$30757$ba4acef3@reader.news.orange.fr> NNTP-Posting-Date: 29 Oct 2011 09:29:11 CEST NNTP-Posting-Host: 90.2.74.48 X-Trace: 1319873351 reader.news.orange.fr 30757 90.2.74.48:8411 X-Complaints-To: abuse@orange.fr Xref: news1.google.com comp.lang.ada:18742 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: 2011-10-29T09:29:11+02:00 List-Id: Le 28/10/2011 23:13, Randy Brukardt a écrit : > I probably would constrain the parameter to have a lower bound of 1. Using > Ada 2012: > > generic > type Element_Type is private; > type Sort_Array_Type is array (Positive range<>) of Element_Type; > with function "<" (Left, Right: Element_Type) return Boolean is<>; > procedure Sort(A: in out Sort_Array_Type) > with Pre => A'First 1; Or maybe something less radical: generic type Element_Type is private; type Sort_Array_Type is array (Positive range<>) of Element_Type; with function "<" (Left, Right: Element_Type) return Boolean is<>; procedure Sort(A: in out Sort_Array_Type) with Pre => A'Last < Positive'Last - 1; I think this covers the problem expressed by the OP, right? Pascal. -- --|------------------------------------------------------ --| Pascal Obry Team-Ada Member --| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE --|------------------------------------------------------ --| http://www.obry.net - http://v2p.fr.eu.org --| "The best way to travel is by means of imagination" --| --| gpg --keyserver keys.gnupg.net --recv-key F949BD3B