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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Georg Bauhaus Newsgroups: comp.lang.ada Subject: Re: Getting types from a generic container in Ada? Date: Sun, 26 Jul 2015 19:36:05 +0200 Organization: A noiseless patient Spider Message-ID: References: Reply-To: nonlegitur@futureapps.de Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 26 Jul 2015 17:34:33 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="0bb2db648eace777a0b1960affd730a0"; logging-data="8322"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/X9uLsT05bk51tVBwmTYrMsOWAJJKIHg8=" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 In-Reply-To: Cancel-Lock: sha1:kELr3/osAgrw3cz695tWJvk6NtE= Xref: news.eternal-september.org comp.lang.ada:27017 Date: 2015-07-26T19:36:05+02:00 List-Id: On 26.07.15 08:08, EGarrulo wrote: > I would like to write a generic package that operates on standard containers. Such package would need access to various properties of a container, and I would like to get them from the container itself, instead of passing them as parameters for the generic package. In other words, I would like to write something like: > > > generic > type Container_Type is private; > package My_Package is > procedure My_Function (Container : in out Container_Type; > Element : Container_Type.Element_Type); > end My_Package; > > > Is this possible? Thank you. Reexport of generic parameters is not part of the design. It is still possible to write some generic algorithms (using formal packages, or signatures, or iterators, to the extent permitted by design and non-recursive Ada templates.)