【发布时间】:2011-10-26 15:32:45
【问题描述】:
为了更好地理解,我可以将以下示例中对 boost::bind 的调用替换为 std::bind1st/2nd 吗?还是因为返回引用而无法实现?
示例(缩短):
class Pos
{
public:
bool operator==( const Pos& );
...
}
class X
{
public:
const Pos& getPos() { return m_p; }
...
private:
Pos m_p;
}
...
Pos position;
std::vector<X> v;
std::vector<X>::iterator iter;
...
iter = std::find_if( v.begin(), v.end(), boost::bind( &X::getPos, _1 ) == position );
...
【问题讨论】: