From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-12-05 09:46:26


----- Original Message -----
From: "Vladimir Prus" <ghost_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Wednesday, December 05, 2001 8:11 AM
Subject: Re: [boost] Boost.Algorithm library

> David Abrahams wrote:
>
> > From: "Vladimir Prus" <ghost_at_[hidden]>
> >
> > > There also three map algorithms that I'd find quite usefull
(especially
> >
> > the
> >
> > > third), but do they fit in the collection? (I think so). They are:
> > > 1. domain : returns the set of map keys
> > > 2. range : returns the set of mapped values
> >
> > Wouldn't those two be done best using a projection iterator adaptor with
> > select1st/select2nd?
> Do you mean implementation or interface? Can you show an example usage? (I
> don't follow iterators adapters closely). Wouldn't it be overly verbose?

    boost::make_projection_iterator(some_map.begin(), std::select1st())

or:

    boost::make_projection_iterator<std::select1st>(some_map.begin())

or:

boost::projection_iterator_generator<std::select1st,my_map_t::iterator>::typ
e
        i(some_map.begin());

The advantage is that you can iterate over keys without causing them to be
copied.