Boost logo

Boost Users :

Subject: Re: [Boost-users] for_each on boost::ptr_map
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2008-09-16 05:19:22


Robert Dailey skrev:
> Hi,
>
> Is there a way I can use std::for_each() on a boost::ptr_map and have
> the functor object be given the *value* of each item iterated instead of
> a key/value pair like it does with std::map? Help is appreciated, thank you.

You have wrap the iterators in new iterators that project the pair-like
structur down to the value. It's the same for std::map. You can find
functions for that in Neil Groves range_ex library in the file vault.

-Thorsten


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