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: Brian Rogoff Subject: Re: Wanted: Ada STL. Reward: Ada's Future Date: 1999/02/05 Message-ID: #1/1 X-Deja-AN: 441063358 References: <790f4q$3l@bgtnsc01.worldnet.att.net> <36B856E4.D921C1D@bton.ac.uk> Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: nntp1.ba.best.com 918236854 16690 bpr@206.184.139.136 MIME-Version: 1.0 Newsgroups: comp.lang.ada Date: 1999-02-05T00:00:00+00:00 List-Id: On 5 Feb 1999, Stephen Leake wrote: > Brian Rogoff writes: > Still, there is a distinction between "Last" and "Finish". In Ada, > indexing an array with Last gives a valid data element. In C++ STL, > dereferencing a "Finish" iterator does _not_ give a vaid data pointer. > That is the essential difference in style. True, it is not the same as 'First and 'Last. A zero length sequence has no valid dereferenceable first or last element, so a general subsequence abstraction should have indices which refer to positions between the elements, not the elements themselves. That makes for the most elegant definition. > Let me ask my question this way. Define an iterator value "Last" that > represents the last valid data element in a container. Define an > iterator value "Finish" that represents no valid data element in a > container. Also define Prev (Finish) == Last. How do we define Last if the container is empty? It seems we either just use Finish, or we screw your definition up a bit. > 1) Are there algorithms that can be expressed in terms of Finish that > cannot be expressed in terms of Last? > > 2) Do we also need Begin and First? or just First? I can't thinnk of a good reason why you need two "off the end" iterators. Just imagine the sequence is a ring buffer. -- Brian