- 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.
- Advanced Splunk
- Mastering Concurrency Programming with Java 8
- HTML5移動Web開發(fā)技術(shù)
- Angular UI Development with PrimeNG
- 面向STEM的Scratch創(chuàng)新課程
- Java Web應(yīng)用開發(fā)技術(shù)與案例教程(第2版)
- Practical Game Design
- Yocto for Raspberry Pi
- Unity Game Development Scripting
- 深入淺出React和Redux
- Elasticsearch Essentials
- MongoDB Cookbook(Second Edition)
- Mastering Machine Learning with R
- JBoss AS 7 Development
- Serverless工程實踐:從入門到進階