Functional Composable Operations with Unix-Style Pipes in C++ - Ankur Satle - CppCon 2022

Discover how to write more readable, maintainable, and composable C++ code using functional principles and Unix-style pipes, and learn about the latest features in C++23 and C++20 to simplify your coding experience.

Key takeaways
  • C++ pipelines allow for functional, composable operations, making code more readable and maintainable.
  • Unix-style pipes can be applied to C++ using optional and function objects.
  • The monadic interface for std::optional in C++23 will enable more expressive and composable code.
  • The concept-based approach to code composition is essential for writing reusable and flexible code.
  • Functional programming principles, such as immutability and referential transparency, can be applied to C++ to improve code quality.
  • Named functions and Lambdas can be used to represent operations in pipelines, making code more concise and expressive.
  • Code organization and management are crucial for maintaining large-scale C++ projects.
  • Unicode-style pipes can be used to compose operations in a straightforward and readable manner.
  • Functional programming can be applied to C++ to reduce the need for explicit error handling and improve code readability.
  • The optional class can be used to represent operations that may or may not succeed, allowing for more robust code.
  • The requirement that the value type of an optional be convertible to bool allows for convenient error checking.
  • The invocable concept can be used to constrain the type of callable objects that can be passed to a function.
  • Named concepts, such as Pipe, can be used to succinctly describe complex operations.
  • C++20’s concepts and ranges can be used to write more expressive and composable code.
  • The optional class provides a way to represent the absence of an object, allowing for more robust error handling.