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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: "J-P. Rosen" Newsgroups: comp.lang.ada Subject: Re: How can I create an empty array of a generic type? Date: Sat, 13 Jul 2019 07:24:10 +0200 Organization: Adalog Message-ID: References: <5f53e122-6b99-48ca-b6cc-4ae43c0a2221@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Date: Sat, 13 Jul 2019 05:24:09 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="41ff433f558ba9af3a34bdc19d1ec8a9"; logging-data="31013"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX199Io+RYfchk+tCPpyMYgh8" User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 Cancel-Lock: sha1:UneQbbL9CJqHXjWU+YGvtPvDYUE= In-Reply-To: Content-Language: fr Openpgp: preference=signencrypt Xref: reader01.eternal-september.org comp.lang.ada:56863 Date: 2019-07-13T07:24:10+02:00 List-Id: Le 13/07/2019 à 06:11, Keith Thompson a écrit : > generic > type Element_Type is private; > type Key_Component_Type is private; > with function "<" (Left, Right : Key_Component_Type) return Boolean is <>; > with function "=" (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) := (others => Dummy); > end Ternary_Trees; > > The Dummy value is a bit ugly. You can avoid it: Empty_Key : constant Key_Type(1..0) := (others => <>); -- J-P. Rosen Adalog 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00 http://www.adalog.fr