Boost logo

Boost :

From: Sohail Somani (s.somani_at_[hidden])
Date: 2006-07-31 11:49:12


Hi,

I'm forwarding this here as I didn't get a reply on the users list.

> -----Original Message-----
> From: Sohail Somani
> Sent: Tuesday, July 25, 2006 2:19 PM
> To: 'boost-users_at_[hidden]'
> Subject: [Lambda] find_if + vector of arrays
>
> Hi,
>
> Why can't lambda figure out the return type of operator[] for
> array? Does it know about vectors? I know I can fix the
> compile error by using bl::ret<double>(bl::_1[0])... But for
> obvious reasons, I'd much rather not!
>
> #include <vector>
> #include <algorithm>
>
> #include <boost/array.hpp>
> #include <boost/lambda/lambda.hpp>
>
> int main()
> {
> namespace bl=boost::lambda;
> using std::vector;
> using boost::array;
>
> array<double,3> cpy = {1};
> vector<vector<double> > a(10,vector<double>(3,1));
> vector<array<double,3> > b(10,cpy);
>
> std::find_if(a.begin(),a.end(),bl::_1[0]==5);
> std::find_if(b.begin(),b.end(),bl::_1[0]==5);
> }
>
> Thanks!
>
> Sohail
>


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