What is Lambda Capture?
Before looking into *this capture, let’s see how lambda capture works in C++. In C++, lambdas are a way to create anonymous functions, which can capture variables from their enclosing scope. There are two primary capture modes: by value and by reference.
Lambda Capture of *this in C++17
In C++, a lambda function can capture variables from the enclosing scope using capture clauses. Lambda functions can also be used to capture this pointer, which allows us to access class members and methods within the lambda. In this article, we will learn how Lambda Capture of *this pointer is changed in C++17.
Contact Us