Boost logo

Boost Users :

From: chun ping wang (cablepuff_at_[hidden])
Date: 2007-10-19 13:06:36


http://lists.boost.org/boost-users/2007/01/24529.php

Is this what you want?

On 10/19/07, Chris Weed <chrisweed_at_[hidden]> wrote:
>
> 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 mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



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