|
Boost : |
From: Chris Weed (chrisweed_at_[hidden])
Date: 2007-11-20 12:07:16
> 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.
Chris
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk