Boost logo

Boost :

From: Dean Michael Berris (mikhailberis_at_[hidden])
Date: 2007-11-20 16:56:32


Hi Chris,

On Nov 20, 2007 9:07 AM, Chris Weed <chrisweed_at_[hidden]> wrote:
> > Recently, I've implemented a simple utility which allows users to
> > select the nth element of an STL pair / Boost.Tuple in conjunction
> > with STL algorithms. This allows precisely the following usage
> > semantics:
>
>
> Hi,
> It would also be nice to make this work with transform_iterator.
> For example
>
> #include <boost/iterator/transform_iterator.hpp>
> std::list<boost::tuple<double, double, double> > coord_list;
> coord_list.push_back(boost::make_tuple(1.0, 2.0, 3.0));
> coord_list.push_back(boost::make_tuple(4.0, 5.0, 6.0));
>
> std::transform(
> boost::make_transform_iterator(coord_list.begin(),boost::select<0>()),
> boost::make_transform_iterator(coord_list.end(),boost::select<0>()),
> std::ostream_iterator<double>(std::cout, " ")); // output "1.0 4.0 "
>
> This would require your select functor conforming to result_of, and
> transform_iterator using it.
>

I've been trying, and it's taking me a while to first of all make it
result_of compliant. Maybe something worth spending more time on, I'm
not sure.

I'll send an update if/when I come up with something to this effect.

Have a good day!

-- 
Dean Michael C. Berris
Software Engineer, Friendster, Inc.
[http://cplusplus-soup.blogspot.com/]
[mikhailberis_at_[hidden]]
[+63 928 7291459]
[+1 408 4049523]

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