Topic: STL: Are hash based container clases in the latest ANSI draft?


Author: jbuck@Synopsys.COM (Joe Buck)
Date: 1996/08/19
Raw View
kanze@lts.sel.alcatel.de (James Kanze US/ESC 60/3/141 #40763) writes:
>FWIW: hash tables, as useful as they are, really do not conceptually fit
>into STL, which is based on the concept of an ordered sequence.

The HP hash table implementation provides begin(), end(), and iterators.
Like set, one cannot insert an arbitrary element at an arbitrary point,
but one can step through the objects in the hash table just fine.
Actually, any hash table implementation I have ever seen provides a
way of stepping through all the objects in the table.  There isn't
any conceptual incompatibility.  One cannot use a hash table to implement
the requirements of the set or map classes, but it makes a perfectly
fine STL-compatible container class.

--
-- Joe Buck http://www.synopsys.com/pubs/research/people/jbuck.html

Work for something because it is good,
not just because it stands a chance to succeed.    -- Vaclav Havel


[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]





Author: kanze@lts.sel.alcatel.de (James Kanze US/ESC 60/3/141 #40763)
Date: 1996/08/20
Raw View
In article <4v8p72$cv1@hermes.synopsys.com> jbuck@Synopsys.COM (Joe
Buck) writes:

|> kanze@lts.sel.alcatel.de (James Kanze US/ESC 60/3/141 #40763) writes:
|> >FWIW: hash tables, as useful as they are, really do not conceptually fit
|> >into STL, which is based on the concept of an ordered sequence.

|> The HP hash table implementation provides begin(), end(), and iterators.
|> Like set, one cannot insert an arbitrary element at an arbitrary point,
|> but one can step through the objects in the hash table just fine.
|> Actually, any hash table implementation I have ever seen provides a
|> way of stepping through all the objects in the table.  There isn't
|> any conceptual incompatibility.  One cannot use a hash table to implement
|> the requirements of the set or map classes, but it makes a perfectly
|> fine STL-compatible container class.

I don't disagree with what you are saying, and I will probably make
extensive use of the publicly available STL hash table.

I was simply addressing the point as to why the hash table wasn't in the
standard.  It isn't in the standard because it was proposed too late,
and it wasn't in the initial proposal, *PERHAPS* (just guessing) because
the basic abstraction of STL is not the containers, but the concept of
sequence defined by the iterators.  While it is not difficult to add
such a concept to a hash table, if one goes *FROM* this concept, a hash
table is not the first container which comes to mind.
--
James Kanze         Tel.: (+33) 88 14 49 00        email: kanze@gabi-soft.fr
GABI Software, Sarl., 8 rue des Francs-Bourgeois, F-67000 Strasbourg, France
Conseils,    tudes et r   alisations en logiciel orient    objet --
                -- A la recherche d'une activit    dans une region francophone
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu
]





Author: kanze@lts.sel.alcatel.de (James Kanze US/ESC 60/3/141 #40763)
Date: 1996/08/16
Raw View
In article <pgpmoose.199608140959.29820@isolde.mti.sgi.com>
rlee@simsci.com (Robert Lee) writes:

|> Elements of my project are using Rogue Wave Tools.h++ which include
|> hash based collection classes. I would like to switch to STL if
|> equivalent functionality will be supported. The HP implementation
|> supports hash based containers although they were not in the draft
|> document at that time. Does the latest ANSI draft support this
|> feature?

No.

The proposal that you find in the HP implementation was added at a
fairly late point in time, and is not from the original authors.  It was
presented to the standards committee, but I think the conclusion was
that it was too late to add something that large.

FWIW: hash tables, as useful as they are, really do not conceptually fit
into STL, which is based on the concept of an ordered sequence.  (The
concept of STL is best exemplified by the iterator pair begin/end, and
the interface and restrictions imposed by this.  From a conceptual point
of view, the containers are secondary.)  A hash table does not naturally
give an ordered sequence, although many of us who use hash tables do
define an arbitrary ordering over the elements.



Author: rlee@simsci.com (Robert Lee)
Date: 1996/08/14
Raw View
Elements of my project are using Rogue Wave Tools.h++ which include
hash based collection classes. I would like to switch to STL if
equivalent functionality will be supported. The HP implementation
supports hash based containers although they were not in the draft
document at that time. Does the latest ANSI draft support this
feature?

Robert
rlee@simsci.com


---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu
]