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:
- Các loại thuế phải nộp cho chính phủ ở Việt Nam
- Tổng hợp và hướng dẫn chi tiết giúp các hộ tiểu thương triển khai tính thuế theo quy định năm 2025
- Publix: Thực hành nhân sự mang lại sự hài lòng cho nhân viên và khách hàng
- 4 bước cần thiết lấy lại tiền khi lỡ chuyển khoản nhầm (Infographic)
- Giới thiệu về các công cụ kiểm thử tự động