On Friday, June 14, Scott Meyers will be giving a talk open to the public at the Oslo C++ Users Group.
From Scott's announcement:
Lambdas vs. std::bind in C++11 and C++14
Scott Meyers
C++ developers have long had a need to bind functions and arguments together for a later call. This is what makes it possible to invoke member functions on objects inside STL algorithms. The same technology can be used to create custom callback functions and to adapt function interfaces to different calling contexts.
In C++98, such binding was accomplished via
std::bind1st
andstd::bind2nd
. TR1 addedstd::tr1::bind
, which was promoted tostd::bind
in C++11. But C++11 also introduced lambda expressions, and they’re slated to become even more powerful in C++14. That means that there are now two mechanisms in C++ for binding functions to arguments for later calls:std::bind
and lambda expressions. In this talk, Scott examines the pros and cons of each approach, comparing them in terms of expressiveness, clarity, and efficiency, and he comes to the conclusion that one should almost always be used instead of the other. But which one?
This presentation assumes a basic familiarity with
std::bind
and C++11 lambda expressions.
Add a Comment
Comments are closed.