Boost logo

Boost :

From: Thomas Witt (witt_at_[hidden])
Date: 2002-11-19 09:30:19

Hash: SHA1


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.

As a sidenote. From my experience you will run into the projection/transform
problem quite frequently. IIRC projection iterators cannot be used on base
iterators that don't have real reference types.

> I find them especially useful in connection with map::iterator, since
> std::map does not have a value_iterator. I guess that alone provides the
> rationale for including such an iterator adaptor, not to mention better
> support of std::pair.

Actually, I'd like to see a more general solution for all kind of tuple like

Smth like

typedef select_iterator<0, std::map<int>::iterator > key_iterator_t;

Btw, templated typedefs anybody ?

> It's simple enough to make two adaptors, so if you don't see anything
> wrong with it, I'm proposing the patch for you. I'll even write the
> corresponding portion of the documentation if you go ahead with it.
> Hope you like it,

I like the idea, and yes I do believe there is a real need. There are just
some issues to be sorted out. I'd like to postpone this until the new
iterator_adaptor version is finished.



- --
Dipl.-Ing. Thomas Witt
Institut fuer Verkehrswesen, Eisenbahnbau und -betrieb, Universitaet Hannover
voice: +49(0) 511 762 - 4273, fax: +49(0) 511 762-3001
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see


Boost list run by bdawes at, gregod at, cpdaniel at, john at