C++ Lambda
Creating a Lambda Expression in C++
A basic lambda expression can look something like this:
auto greet = []() {
// lambda function body
};
Here,
[]is called the lambda introducer which denotes the start of the lambda expression()is called the parameter list which is similar to the()operator of a normal function
The above code is equivalent to:
void greet() {
// function body
}
Now, just like the normal functions, we can simply invoke the lambda expression using:
greet();
Note: We have used the auto keyword to automatically deduce the return type for lambda expression.
Tin khác:
- [THÔNG BÁO] – Lịch bảo vệ Capstone 1&2 (chỉnh thức) và Một số lưu ý quan trọng
- Giới thiệu khoá học IPv6 Address Planning Course (APNIC Academy)
- NHỮNG KĨ NĂNG CẦN THIẾT CỦA SINH VIÊN NĂM NHẤT TRONG THỜI ĐẠI CÔNG NGHỆ SỐ
- Hướng dẫn cài đặt Flask cho ứng dụng Python trên aaPanel
- CẢNG BIỂN VÀ CÁCH VẬN HÀNH CẢNG BIỂN