$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: Ben Hutchings (ben.hutchings_at_[hidden])
Date: 2004-12-13 14:36:52
David Abrahams wrote:
> Ben Hutchings wrote:
> 
>>Jim Lear wrote:
>>
>>>The map iterators are really what tripped me up as an STL newbie.  One 
>>>must understand the iterators are implemented as pairs for maps, and 
>>>pointers for vectors and other things.  By providing an "T 
>>>operator[](iterator)" function for random access and associative 
>>>containers (and for sequences maybe), one could achieve a consistant 
>>>interface.
>>
>>Container-independent code is an impossible and pointless goal.  maps 
>>have different semantics from other containers.  You may want to iterate 
>>over just the mapped values, but other people may want to iterate over 
>>the keys, or over the pairs (and indeed, so may you, in other part of 
>>your program).  Who's to say which of these is right?  What you can do 
>>is to write iterator-independent code, then use an iterator adapter to 
>>convert the iterators over pairs into iterators over the mapped values:
> 
> 
> Have you seen http://www.zib.de/weiser/vtl/ and
> http://www.boost.org/libs/range/index.html?
I think I've seen them mentioned before but I haven't actually looked 
into them.  I dare say they would be easier to use than what I suggested.
Sorry about the duplicate of my message - the local mail server was 
acting up and I thought the first copy hadn't actually been sent.
Ben.