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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,37d542b9779583be,start X-Google-Attributes: gid103376,public From: "NYGREN JONAS" Subject: STL in Ada Date: 1999/02/08 Message-ID: <36be1ed2.0@d2o41.telia.com>#1/1 X-Deja-AN: 441813443 X-NNTP-Posting-Host: 195.67.252.81 Organization: Telia Internet Services X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3155.0 Newsgroups: comp.lang.ada X-Complaints-To: abuse@internet.telia.com Date: 1999-02-08T00:00:00+00:00 List-Id: I have started to read c.l.a after being away a long time. Found it interesting that the question of a 'standard' Ada library (for containers and algorithms) still is on the chart. So I started to think of how one would implement a set of algorithms that work over a set of iterators with different capabilities, like in STL. I am curious if anybody have come up with any ideas of how this should be done? I arrived at an outline for a solution given below - is this the best way to go? /jonas -- the iterators: generic type Item_Type is private; package Iterator is -- To Do: Add abstract methods for each Iterator type -- A container would derive from the appropriate iterator type -- and implement the abstract methods (TBD) -- Possible Problem: Output_Iterator. As I understand it -- Forward_Iterator inherits capabilities -- from both Input as well as Output_Iterator -- but there is no (?) way to describe this type Root is tagged null record; type Input is new Root with null record; type Output is new Root with null record; type Forward is new Input with null record; type Bidirectional is new Forward with null record; type Random is new Bidirectional with null record; end Iterator; -- the Algos with Iterator; generic with package An_Iterator is new Iterator (<>); package Algo is generic function Less (A, B : An_Iterator.Item_Type) return Boolean; function Min (First, Tail : An_Iterator.Forward'Class) return Boolean; end Algo;