4 Creating new functions from the old ones

This chapter covers

  • Understanding partial function application
  • Fixing function arguments to specific values with std::bind
  • Using lambdas for partial function application
  • Are all functions in the world unary?
  • Creating functions that operate on collections of items

Most programming paradigms tend to provide a way to increase code reusability. In the object-oriented world, we create classes we can later use in various situations. We can use them directly or combine them to implement more-complex classes. The possibility of breaking complex systems into smaller components that can be used and tested separately is a powerful one.

In the same way that OOP gives you the tools to combine and modify types, ...

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.