3 Function objects
This chapter covers
- Different things that can be used as functions in C++
- Creating generic function objects
- What lambdas are, and how they relate to ordinary function objects
- Creating prettier function objects with the Boost.Phoenix library and by hand
- What
std::function
is and when to use it
You saw how to create functions that can accept other functions as their arguments in the previous chapter. Now you’ll check out the other side of the coin—to see all the things that you can use as functions in C++. This topic is a bit dry, but it’s necessary for the deeper understanding of functions in C++ and for achieving that sweet spot of using higher-level abstractions without incurring performance penalties. If you want ...
Get Functional Programming in C++ now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.