cpp11

How to Capture Member Variables in Lambda function in C++?

In this article, we will discuss how to capture member variables from the outer scope. Wrong way to capture member variable in Lambda — Compile Error Suppose we have a class OddCounter to keep track of the odd numbers read by the object. Inside its member function, we are creating a lambda function and passing […]

How to Capture Member Variables in Lambda function in C++? Read More »

C++11 Lambda: Capture Variables by Reference or Value

Lambda Functions were introduced in C++11, and it allows us to write Inline, Anonymous Functions. Lambda Functions are also called Lambda Expressions. These Lambda expressions/functions are particularly useful when you need to pass a small function as an argument to another function as callbacks, such as a sorting algorithm or a thread constructor. In this

C++11 Lambda: Capture Variables by Reference or Value Read More »

Scroll to Top