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=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,34c2aa33b8bdb1a9 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-01-18 10:58:48 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!feeder.qis.net!sn-xit-02!sn-post-02!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: "Matthew Heaney" Newsgroups: comp.lang.ada Subject: Re: Sugestion to Multiple Inheritance Date: Fri, 18 Jan 2002 14:03:26 -0500 Organization: Posted via Supernews, http://www.supernews.com Message-ID: References: <3C444B8D.70309@mail.com> X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700 X-Complaints-To: newsabuse@supernews.com Xref: archiver1.google.com comp.lang.ada:19068 Date: 2002-01-18T14:03:26-05:00 List-Id: "Lutz Donnerhacke" wrote in message news:slrna48km8.ka.lutz@taranis.iks-jena.de... > Exactly. Matthew showed also the impact of multiple inheritance by > duplicating the multiple included structure A. I'm pretty sure to find a way > without MI. Simply by designing the whole type more carefully and use > derivated packages. It's not clear what you're trying to do here, using a type hierarchy. Do you want a generic algorithm, that works for any kind of collection? If so, then what's wrong with the model that the C++ STL uses? It doesn't use tagged types, just generics. You can do something very similar in Ada95: generic type Iterator_Type is private; with function Is_Less (L, R : Iterator_Type) return Boolean is <>; with procedure Swap (L, R : Iterator_Type) is <>; with function "+" (L : Iterator_Type; R : Integer) return Iterator_Type is <>; with function "-" (L : Iterator_Type; R : Integer) return Iterator_Type is <>; with function "-" (L, R : Iterator_Type) return Integer is <>; with function "<" (L, R : Iterator_Type) return Boolean is <>; with function "=" (L, R : Iterator_Type) return Boolean is <>; procedure Generic_Quicksort (First : in Iterator_Type; Back : in Iterator_Type); This will work for any collection that has an iterator. It even works for arrays. The algorithm itself doesn't know anything about the collection type or the item type.