Reputation: 122412
I'm getting a compiler error with bind
:
using namespace std;
bool odp(int arg1, int arg2);
// ...
find_if(vec.begin(), vec.end(), tr1::bind(odp, iValue, _1)); // C2065
My goal is to curry odp()
, so its first argument is iValue
, and apply that function in find_if
.
The error:
C2065: '_1' : undeclared identifier.
What am I doing wrong?
Upvotes: 1
Views: 555
Reputation: 106530
2 things here.... 1st of all, it's entirely possible your compiler does not support TR1. Visual Studio 2008, for example, does not support TR1, unless you install Visual Studio 2008 Service Pack 1.
Second, I believe you need a namespace qualification for _1
.
Upvotes: 1
Reputation: 354999
You need using namespace std::tr1::placeholders
or using std::tr1::placeholders::_1
.
Upvotes: 4