
11 Mar
2004
11 Mar
'04
8:19 p.m.
Howard Hinnant <hinnant@twcny.rr.com> writes:
On Mar 11, 2004, at 9:42 AM, David Abrahams wrote:
This surprised me; should it have?
#include <boost/bind.hpp> #include <boost/mem_fn.hpp>
struct X { int y; };
int main() { boost::mem_fn(&X::y); // OK boost::bind(&X::y); // Error! }
I'm not seeing any surprises. mem_fn(&X::y) produces a function object that takes one parameter. Therefore the bind equivalent needs an argument or a placeholder:
bind(&X::y, _1);
DUH!! Thanks, Howard! -- Dave Abrahams Boost Consulting www.boost-consulting.com