Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2007-11-19 10:54:19


Dean Michael Berris wrote:
>
> * Boost.Range friendly versions of the STL algorithms

The Range_ex library is quite possibly what you're looking for.

http://www.boost-consulting.com/vault/index.php?directory=Algorithms

Documentation is here:

http://boost-sandbox.sf.net/libs/range_ex

This work is based on an earlier containers algorithm library by Jeremy
Siek and Vladimir Prus.

> * SGI's select1st and select2nd generalized -- I'm not sure if you've
> found yourself dealing with std::map's and std::list<std::pair<,> >'s
> a lot, but I do, and there is a lot of merit in something like the
> following:
>
> template <const N>
> struct select {
> template <class T>
> mpl::at_c<T, N>::type operator() (T element) const {
> return mpl::at_c<T, N>(element);
> };
> };
>
> So that you can go ahead and see code like (with the STL adapters from above):
>
> std::transform(
> boost::make_range(my_map),
> select<1>(),
> std::ostream_iterator<my_map::value_type::second_type>(std::cout)
> );

Could be pretty useful. I'm not aware of anything like this in Boost
already.

-- 
Eric Niebler
Boost Consulting
www.boost-consulting.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk