MSK Institute • Shikohabad
Loading Page Content...
Preparing courses, live labs, and learning resources.सामग्री लोड हो रही है, कृपया प्रतीक्षा करें...
Connecting serverPlease wait...
💻 Practical Labs🚀 Free Demo📜 Verified Certificates
Preparing courses, live labs, and learning resources.सामग्री लोड हो रही है, कृपया प्रतीक्षा करें...
A lambda expression is an anonymous function object defined inline at the call site. Introduced in C++11 and refined in Modern C++, lambdas simplify working with STL algorithms.
The capture clause controls which variables from the enclosing outer scope are accessible inside the lambda:
| Capture Clause | Meaning |
|---|---|
[] | No captures: Can only access parameters passed to the lambda |
[x] | Captures variable x by value (copy) |
[&x] | Captures variable x by reference |
[=] | Captures all used outer variables by value (copy) |
[&] | Captures all used outer variables by reference |
Continue learning with hands-on practice, examples, and exercises in the upcoming topic.
Test your understanding of this lesson with 1 questions. Each question has one correct answer.