Possible Duplicate:
Bind Vs Lambda?
My use of std::bind had dropped to 0 now that lambdas have gained wide support.
Are there any problems that std::bind is uniquely suited for over a lambda function?
Was there a compelling reason to keep std::bind in the standard once lambdas where added?
You can capture by value or by reference, and the problem is that capture by value really means ‘capture by copy’. This is a show stopper for a move-only type. So you can’t use a lambda to do the following:
IIRC the Standard Committee briefly considered allowing arbitrary expression inside a lambda capture list to solve this (which could look like
[std::move(f)] { return f.bar(); }), but I don’t think there was a solid proposal and C++11 was already running late.That and the restriction to monomorphic behaviour with lambdas are the deal breakers for me.