Skip to content

Lambdas vs. std::bind in C++11 and C++14

Photo of Olve Maudal
Hosted By
Olve M.
Lambdas vs. std::bind in C++11 and C++14

Details

Scott Meyers (http://www.aristeia.com/) visits Oslo next week. On Monday and Tuesday he is teaching a course on Effective C++11/14 Programming (http://www.programutvikling.no/kurs/effective-c11-14-programming/2918) (OCPPUG members gets 15% off), and he will attend and give talks at the Norwegian Developer Conference (http://www.ndcoslo.com/). But on Friday evening, he will join Oslo C++ Users Group to Scotsman to give a talk on lambdas vs. std::bind in C++11 and C++14. Here is the description of the talk:

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 and std::bind2nd. TR1 added std::tr1::bind, which was promoted to std::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 talks assumes a basic familiarity with std::bind and C++11 lambda expressions.

Doors open at 1800. The formal part of the meeting starts 1830. Some of us will arrive early to eat before the talk. The formal part of the meeting ends 2030. But as usual, a lot of us will stay in the pub to continue deep discussions on C++.

Please use this opportunity to also invite more colleagues and friends to join Oslo C++ Users Group.

Photo of Oslo C++ Users Group group
Oslo C++ Users Group
See more events
The Scotsman
Karl Johans g 17, 0159 Oslo · Oslo