[geos-devel] Iterator adapter - question
Mateusz Loskot
mateusz at loskot.net
Fri May 26 12:15:11 EDT 2006
strk at refractions.net wrote:
> Mateus, the whole issue is related to make a std::map iterator return
> values rather then pair(key,value) so we can't consider them
> "exception" but rather the main focus.
I understood that this adapter should unify all collections
you're using in GEOS. That's why I called std::map as an exception.
> Probably a MapValueIterator would do as we wouldn't need an adapter
> for the other containers.
as I said, I understand the adapter should work on all containers,or I'm
wrong here?
> I already suggested a simpler interface: only use for the iterator
> would be:
>
> comparison ( current != end ) // map_iter == other.map_iter
> dereference ( *current ) // return map_iter->second advance (
> ++current; current++; ) // ++map_iter; map_iter++
That's clear
> I don't know if making this a STL-compatible iterator would do. For
> example, would standard algorithms rely on the *dereference operator
> ?
Yes. Is this a problem?
> Note that we wouldn't need most operations defined for standard
> iterators.
What you mean?
There are 5 categories of iterators in STL:
input, output, forward, bidirectional and random access.
Those categories differs in capabilities, so they are usable in
algorithms depending on their category.
Cheers
--
Mateusz Łoskot
http://mateusz.loskot.net
More information about the geos-devel
mailing list