What is meaning of "[=]" in cpp

c++, c++11, lambda

Solution

A lambda is an unnamed/anonymous function that is useful in programming due to it's short snippets of code.

lambda function in C++ defined like this

[]() { }

`[]` is the capture list, `()` the argument list and `{}` the function body.

The capture list defines what from the outside of the lambda should be available inside the function body and how. It can be either:

- a value: [x]

- a reference [&x]

- any variable currently in scope by reference [&]

- same as third type, but by value [=]

You're passing a lamda function as third argument using fourth capture list.

NodeScheduleLambda(this, 0.01f, [=]{ this->removeFromParentAndCleanup(true); });

Problem

Please check this code below: ``` NodeScheduleLambda(this, 0.01f, [=] { this->removeFromParentAndCleanup(true); }); ``` In that what is the meaning of "[=]" this. Can any one help me.Thank you...

Original source