- 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.
- Boost C++ Application Development Cookbook(Second Edition)
- oreilly精品圖書:軟件開發者路線圖叢書(共8冊)
- 深入理解Java7:核心技術與最佳實踐
- Learning ArcGIS for Desktop
- Terraform:多云、混合云環境下實現基礎設施即代碼(第2版)
- Python極簡講義:一本書入門數據分析與機器學習
- Python:Deeper Insights into Machine Learning
- Delphi開發典型模塊大全(修訂版)
- 安卓工程師教你玩轉Android
- Microsoft Dynamics GP 2013 Cookbook
- Flask開發Web搜索引擎入門與實戰
- 信息學奧林匹克競賽初賽精講精練
- 3D Printing Designs:Design an SD Card Holder
- Magento 2 -Build World-Class online stores
- Getting Started with SpriteKit