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-Received: by 2002:a0c:b909:: with SMTP id u9mr14416005qvf.10.1563102600357; Sun, 14 Jul 2019 04:10:00 -0700 (PDT) X-Received: by 2002:aca:1a0e:: with SMTP id a14mr9727753oia.51.1563102600103; Sun, 14 Jul 2019 04:10:00 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!b26no7917705qtq.0!news-out.google.com!a5ni307qtd.0!nntp.google.com!b26no7917693qtq.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 14 Jul 2019 04:09:59 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2001:4644:6579:0:b9a1:c1dd:8aa1:90e3; posting-account=bPTmZAoAAAC_6HP9XLKB9aAAxBa6BuOR NNTP-Posting-Host: 2001:4644:6579:0:b9a1:c1dd:8aa1:90e3 References: <5f53e122-6b99-48ca-b6cc-4ae43c0a2221@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <8a591def-8148-433e-bd19-e88b22f50284@googlegroups.com> Subject: Re: How can I create an empty array of a generic type? From: reinert Injection-Date: Sun, 14 Jul 2019 11:10:00 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader01.eternal-september.org comp.lang.ada:56870 Date: 2019-07-14T04:09:59-07:00 List-Id: l=C3=B8rdag 13. juli 2019 23.19.28 UTC+2 skrev Keith Thompson f=C3=B8lgende= : > "J-P. Rosen" writes: > > Le 13/07/2019 =C3=A0 06:11, Keith Thompson a =C3=A9crit: > >> generic > >> type Element_Type is private; > >> type Key_Component_Type is private; > >> with function "<" (Left, Right : Key_Component_Type) return Boolean = is <>; > >> with function "=3D" (Left, Right : Element_Type) return Boolean is <= >; > >> package Ternary_Trees is > >> type Key_Type is array(Positive range <>) of Key_Component_Type; > >> private > >> Dummy: Key_Component_Type; > >> Empty_Key : constant Key_Type(1..0) :=3D (others =3D> Dummy); > >> end Ternary_Trees; > >>=20 > >> The Dummy value is a bit ugly.=20 > > You can avoid it: > > Empty_Key : constant Key_Type(1..0) :=3D (others =3D> <>); >=20 > Yes, that's better than my suggestion. (That feature was introduced in > Ada 2005.) >=20 > --=20 > Keith Thompson (The_Other_Keith) kst-u@mib.org > Will write code for food. > void Void(void) { Void(); } /* The recursive call of the void */ But Key_Type is an array indexed by Positive (> 0). =20 The zero in "Key_Type(1..0)" is not so intuitive for me (outside the range)= ? reinert