On Tue, Nov 19, 2002 at 10:35:00AM -0500, David Abrahams wrote:
> > On Tuesday 19 November 2002 07:11, Herve Bronnimann wrote:
> >> Dave, Jeremy: one iterator adaptor I needed often (and once again today)
> >> is the projection on the first or second member of a pair. I could make
> >> it using projection_iterator<> and select1st, except that select1st is
> >> an std extension from SGI. I haven't found any other out-of-the-box way
> >> to do this, did I miss something?
> >
> > Not as far as I can see.
> 
> Can't you just use make_projection_iterator with bind(&pair<X,Y>::first) ?

Would work fine for boost::compressed_pair, but not for std::pair, IIUC.
In one, first is a member function, but in the other it's just a public data
member. Even assuming it works, would it inline the access to first
properly? Just wondering.

I like Thomas' suggestion about tuples. If it could be made to work for
tuples AND std::pairs, it would get my vote. I'll think about it.
Meanwhile, std::pair is pretty special among tuples due to its relation
to std::map and other parts of the standard. But looking forward, tuples
might become just as important... point taken.

Thanks for the replies,
-- 
Herve'


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to