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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7ee10ec601726fbf X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-11-01 21:21:24 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!sjcppf01.usenetserver.com!usenetserver.com!news-west.rr.com!news-east.rr.com!cyclone1.gnilink.net!spamfinder.gnilink.net!typhoon2.gnilink.net.POSTED!not-for-mail Message-ID: <3BE22D47.2050004@mail.com> From: Hyman Rosen User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:0.9.5+) Gecko/20011031 X-Accept-Language: en-us MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: why not References: <3BC5D730.DA950CC7@boeing.com> <9q4pa7$1ad$1@nh.pace.co.uk> <3BC6ACC8.23EF21BC@free.fr> <3BC71F54.1FFE78FA@boeing.com> <1KGx7.26476$ev2.35117@www.newsranger.com> <3BC7AD82.2A0CCCD4@acm.org> <9qhiqr$af0$1@nh.pace.co.uk> <1nDC7.180$6S7.92255364@newssvr11.news.prodigy.com> <9rjsak$bp3$1@nh.pace.co.uk> <9rmhb9$o1b$1@nh.pace.co.uk> <3BDEF0FE.B55FED9E@san.rr.com> <9rmuqi$es$1@nh.pace.co.uk> <3BDF1F13.4B99361C@san.rr.com> <9rnbtv$5i4$1@nh.pace.co.uk> <3BDF8C59.5020108@mail.com> <9rp9bk$6m9$1@nh.pace.co.uk> <9rrtkt$bum$1@nh.pace.co.uk> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 02 Nov 2001 05:21:07 GMT NNTP-Posting-Host: 151.202.115.190 X-Complaints-To: business-support@verizon.com X-Trace: typhoon2.gnilink.net 1004678467 151.202.115.190 (Fri, 02 Nov 2001 00:21:07 EST) NNTP-Posting-Date: Fri, 02 Nov 2001 00:21:07 EST Xref: archiver1.google.com comp.lang.ada:15615 Date: 2001-11-02T05:21:07+00:00 List-Id: Marin David Condic wrote: > Sorting needs to be inside of the data structure - not done > externally. Not necessarily. In the C++ STL, for example, sort algorithms work on ranges, specified by the usual half-open interval using a pair of iterators. But the iterators must be random-access (pointer abstractions - you can add an integer to them to get another valid one, and the difference of two is the number of elements in the interval), so you can sort within vectors, deques, strings, and plain arrays, but not within lists or maps. Trying to sort with the wrong kind of iterators fails to compile, so you don't get the usual unsafe crashes. There are also algorithms which require a sorted range, and in that case you can, for example, use iterators into a map, since the map is implicitly sorted.