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,effb80d4bb7716dd X-Google-Attributes: gid103376,public From: John English Subject: Re: Wanted: Ada STL. Reward: Ada's Future Date: 1999/02/03 Message-ID: <36B856E4.D921C1D@bton.ac.uk>#1/1 X-Deja-AN: 440224557 Content-Transfer-Encoding: 7bit References: <790f4q$3l@bgtnsc01.worldnet.att.net> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: University of Brighton Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 1999-02-03T00:00:00+00:00 List-Id: Brian Rogoff wrote: > On Mon, 1 Feb 1999, Ehud Lamm wrote: > > It seems that one problem in implementing STL in Ada95 is the lack of > > pointer arithmetic. This causes perofremance problems in real sense (to > > be exact the result is worse from a complexity point of view). > > I don't know what you mean here. Could you explain, or provide a pointer? :-) IMHO performance is not the problem for implementing the STL in Ada. For STL, a nice consequence of the pointer semantics in C and C++ is that for a collection of N items, there are N+1 points where you can insert a new item, and C/C++ pointer semantics lets you refer to the position past the end of an array. This means that you have a way of referring to the "extra" position by using a "beyond the end" pointer in an array. The STL uses ranges [i,j) which cover the range from the iterator i up to but not including the position j. This works just as well for arrays as it does for vectors or maps or whatever. In Ada this isn't possible -- e.g. type Foo is array(Boolean) of Bar has no "beyond the end" index that can be used to form non-inclusive ranges [i,j). This makes it hard to support arrays as "just another collection type" in the way that the STL does, so you can't easily define algorithms which can be applied impartially to arrays or vectors or maps or whatever. ----------------------------------------------------------------- John English | mailto:je@brighton.ac.uk Senior Lecturer | http://www.it.bton.ac.uk/staff/je Dept. of Computing | ** NON-PROFIT CD FOR CS STUDENTS ** University of Brighton | -- see http://burks.bton.ac.uk -----------------------------------------------------------------