求教vs2005下的lower_bound使用
代码如下,主要是调用lower_bound哪行出的错
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
struct Element{
int i;
};
bool IsLess(const Element& i, const Element& j)
{
return i.i < j.i;
}
bool IsLittle(const Element i, int * j)
{
return i.i < *j;
}
int main()
{
vector<Element> v;
int i = 0;
Element e;
for (i=10; i>0; --i)
{
e.i = i;
v.push_back(e);
}
sort(a.begin(), a.end(), IsLess);
vector<Element>::iterator it;
int j = 4;
it = lower_bound(a.begin(), a.end(), &j, IsLittle);
cout << (*it).i << endl;
return 0;
}
问题出现在lower_bound函数上,在dev下编译运行没有问题。但是在vs2005下,总提示c:\program files\microsoft visual studio 8\vc\include\xutility(314) : error C2664: “bool (const Element &,int *)”: 不能将参数 2 从“Element”转换为“int *”
在release下编译运行都没问题,但问题是我在其它地方用到了lower_bound,而且我想看一下那个程序运行过程的一些中间结果,每次都cout肯定不现实,但是只要用lower_bound就无法debug,求高人指点如何解决这个问题。