Boost logo

Boost Users :

From: Niels Aan de Brugh (niels_at_[hidden])
Date: 2007-11-29 15:04:19


On 2007-11-29, John Kiopela <john.kiopela_at_[hidden]> wrote:
>
> I have been browsing through the docs, but I couldn't find anything useful.
> Does Boost have a std::map<K, V>::iterator adaptor which iterates over the
> values of the map only.

What about using a boost::transform_iterator<>? Docs at:

  http://boost.org/libs/iterator/doc/transform_iterator.html

You'd have to supply it with a function object that returns the 'second'
member variable of the pair, e.g.

  struct get_pair_value
  {
      template< typename K, typename V >
      V operator()( std::pair< K, V > const& pr )
      { return pr.second; }
  };
  
Or you could use Boost.Lambda.

N.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net