Boost logo

Boost Users :

From: Chris Weed (chrisweed_at_[hidden])
Date: 2007-10-19 12:27:09


Hi,
I would like to bind to the boost::get<N> function for use by
transform iterator.
This is the pseudo code if get worked like a simple function.

std::vector<tuple<int,int,float> > v(2);
v[0] = tuple<int,int,float>(2,2,2.2f);
v[1] = tuple<int,int,float>(3,3,3.3f);
std::accumulate(
  boost::make_transform_iterator(
    v.begin(),
    boost::lambda::bind(&boost::get<1>,_1)),
  boost::make_transform_iterator(
    v.end(),
    boost::lambda::bind(&boost::get<1>,_1)),
0);

I find bind is difficult to use for functions that deduce template
arguments from function arguments.

I thought if I changed boost::get<1> -> boost::get<1,tuple<int,int,float> >

That didn't work either. Digging through tuple.hpp makes my head spin.
Is there an easy way to do this.

Thanks,
Chris


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