Article View: comp.std.c++
Article #1704Re: Why is "valarray" not an STL container?
From: John Max Skaller
Date: Thu, 10 Aug 1995 06:25
Date: Thu, 10 Aug 1995 06:25
46 lines
2703 bytes
2703 bytes
In article <1995Aug4.165955@opal.tufts.edu>,
Jonathan Borden <jkauer@opal.tufts.edu> wrote:
>In article <3vo8a7$jde@metro.ucc.su.OZ.AU>, maxtal@Physics.usyd.edu.au (John Max Skaller) writes:
>> valarray isn't an STL container because its purpose is
>> quite different. Here's my picture:
>>
>> STL is based on the notion that everything can be organised
>> into sequences: these sequences are represented by pairs of iterators.
>> There are no trees in STL because a tree isn't a linear sequence.
>
> hmmm... what about maps & sets, the hp implementation (and hence
>many derivatives) code these as red-black trees. In STL there are several
>types of iterators, a sequential iterator is one type, however, random access
>iterators also exist.
Perhaps I didn't explain well. Random access iterators indeed
exist, as does a container "set". But a random access is a shorthand
for sequential access, and an associative lookup is a shorthand
for a search of a linearly ordered set of elements.
That is, a set is first and foremost a sequence in which
inserting a new element automatically positions the element in
the "right" place in the sequence, as is a map: these things are "subtypes"
of "sequences", that is, some of the methods can be made faster
(or are even possible) because they maintain stricter invariants
that the most basic linear access requirement. (sequential iteration)
>> Why just sequences? The answer is that that is all that
>> a single thread of control can handle. Even conceptually parallel
>> processes must be organised into _some_ sequence for a conventional
>> computer to use it.
>>
> Since STL in fact supports more than lists and vectors as containers
>this answer does not follow. I'm not sure that STL references types of CPU's
>at all.
A vector is a sequence, obviously. So is a list.
The very notion of iteration is inherently a question of
enumerating things: linearity.
--
JOHN (MAX) SKALLER, INTERNET:maxtal@suphys.physics.su.oz.au
Maxtal Pty Ltd,
81A Glebe Point Rd, GLEBE Mem: SA IT/9/22,SC22/WG21
NSW 2037, AUSTRALIA Phone: 61-2-566-2189
Technical Details
Message-ID:
<40c8ot$q00@metro.ucc.su.OZ.AU>Path:
arc1-ca.pugleaf.net!news.cs.su.oz.au!metro!newsReferences:
<3ukjva$ntd@engnews2.Eng.Sun.COM> <3um3id$qf1@offas_dike.sbil.co.uk> <3vo8a7$jde@metro.ucc.su.OZ.AU> <1995Aug4.165955@opal.tufts.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!news.cs.su.oz.au!metro!news From: maxtal@Physics.usyd.edu.au (John Max Skaller) Newsgroups: comp.std.c++ Subject: Re: Why is "valarray" not an STL container? Date: 10 Aug 1995 06:25:33 GMT Organization: School of Physics, University of Sydney, Australia Distribution: inet Message-ID: <40c8ot$q00@metro.ucc.su.OZ.AU> References: <3ukjva$ntd@engnews2.Eng.Sun.COM> <3um3id$qf1@offas_dike.sbil.co.uk> <3vo8a7$jde@metro.ucc.su.OZ.AU> <1995Aug4.165955@opal.tufts.edu> NNTP-Posting-Host: physics.su.oz.au