
Robert Jones wrote:
typedef pair<int, S *> Pair; vector<Pair> pairs; bool trueForAll = ( find_if( _1, _2, _3 ) == _2 )( pairs.begin( ), pairs.end( ), ! bind( & S :: predOfS, bind( & Pair :: second, _1 ) ) ); }
The last line gives me compile errors.
Two things: - I think I need to specicy the template parameters to find_if, but I'm not sure quite what they are!
Why are you even doing this? find_if(pairs.begin(), pairs.end(), your_lambda_expression) is sufficient. Otherwise, it is more practical to use a lazy function. Phoenix is better for that, and it actually already provides lazy versions of standard algorithms.
- The error message reckons the last arg to find_if is placeholder<4>, not placeholder<3>, why?
Because _1 is placeholder<0>.