Topic: hash iterator category issue
Author: marg64@yahoo.com (Vahan Margaryan)
Date: Thu, 7 Mar 2002 21:46:59 GMT Raw View
Hi,
I have just read the proposal for hash-tables written by Matt Austern
(http://std.dkuug.dk/jtc1/sc22/wg21/docs/papers/2001/n1326.html).
Almost all decisions made there are great to me and relieve me a lot
:) (We have been using STL-like hash-tables extensively, and care a
lot about what will appear in the standard). One statement that
concerns me, though, is the one about the category of the hash
container iterators:
"This proposal allows both choices. It requires hashed associative
containers to provide forward iterators. An implementation that
provides bidirectional iterators is conforming, because bidirectional
iterators are forward iterators."
Why not require the implementation to support both types of iterators
(and, consequently, both singly-linked list and doubly-linked list
implementations)? The user would then choose the desired
implementation through an extra policy template parameter.
IMHO allowing variation here makes the code that uses the containers
much less portable. Even when porting from a more 'restrictive'
library to a less 'restrictive' one, we face a space usage increase
issue. That could mean a redesign of code.
Porting in the other direction is more likely to cause rewrites of
some code. Many users won't even know that bidirectional iterators
aren't standard, until they try to port.
The template-dependent mechanism that I mentioned introduces
additional complexities for the implementors. But I think it's worth
it (especially since it's the library implementors who will do it, not
us users :)
Perhaps I'm too subjective on this issue. What do you think?
-Vahan
---
[ 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 ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html ]