C++使用function adapter的问题——未定义标识符

vector<int> filter2(const vector<int> &vec,int val,less<int> &lt)
{
    vector<int> nvec;
    vector<int>::const_iterator iter=vec.begin();
    //bind2nd(less<int> val);会把val绑定在less<int>的第二个参数上
    while ((iter=find_if(iter,vec.end(),bind2nd(lt,val)))!=vec.end())
    {
        nvec.push_back(*iter);
        iter++;
    }
    return nvec;
    find_if(iter,vec.end(),bind2nd(lt,val));
}

已经添加了functional头文件
while表达式中的bind2nd提示未定义标识符;
但是我下面写了一行find_if(iter,vec.end(),bind2nd(lt,val));就不显示错误。

template<typename InputIterator,typename OutIterator,typename elemType,typename Comp>
OutIterator filter(InputIterator first,InputIterator last,OutIterator at,const elemType &val,Comp pred)
//at用以指定从何处开始复制元素
{
    while ((first=find_if(first,last,bind2nd(pred,val)))!=last)
    {
        cout<<*first;
        //assign操作,令两个iterator共同前进
        *at++=*first++;
    }
    return at;
}

下面的这一段代码,while表达式中同样使用了bind2nd,就没有报错。

而且我发现,在第一段代码中,先出现的bind2nd会提示未定义标识符——不管这个bind2nd出现在while表达式以内还是以外。
求大神解答!!!谢谢

直接换std::bind()函数不好用吗,