- Learning C++ Functional Programming
- Wisnu Anggoro
- 187字
- 2021-07-02 20:51:37
Simplifying the function notation using a Lambda expression
The Lambda expression is an anonymous notation that represents something that performs an operation or calculation. In functional programming, the Lambda expression is useful to produce the first class and pure function, which we will discuss in separate chapters in this book. For now, let's familiarize ourselves with this new feature introduced in C++11 by investigating three basic parts of the Lambda expression:
- capturing list: []
- parameter list: ()
- body: {}
The order of these three basic parts is as follows:
[](){}
The capturing list part is also used as a mark to identify the Lambda expression. It is a placeholder to value to be involved in the expression. The only capture defaults are the ampersand symbol (&), which will implicitly capture the automatic variables by reference, and the equal sign (=), which will implicitly capture the automatic variables by copy (we will discuss it further in the upcoming section). The parameter list is similar to the capturing list in every function where we can pass the value to it. The body is the implementation of the function itself.
- C語言程序設計案例教程
- Python概率統計
- 深入淺出Java虛擬機:JVM原理與實戰
- Selenium Design Patterns and Best Practices
- TypeScript圖形渲染實戰:基于WebGL的3D架構與實現
- Visual Basic程序設計實驗指導(第4版)
- QTP自動化測試進階
- Windows Server 2016 Automation with PowerShell Cookbook(Second Edition)
- SQL Server與JSP動態網站開發
- Visual Basic程序設計上機實驗教程
- Vue.js 2 Web Development Projects
- OpenStack Networking Essentials
- 分布式數據庫原理、架構與實踐
- Python大規模機器學習
- Kotlin程序員面試算法寶典