[Lambda] find_if + vector of arrays

25 Jul
2006
25 Jul
'06
9:19 p.m.
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
6894
Age (days ago)
6894
Last active (days ago)
0 comments
1 participants
participants (1)
-
Sohail Somani