I am learning some C++ code which uses boost library. And there are some code like this:
getService().post( [=] {...} )
getService() is a function which returns an io_service of boost library. I want to know what this symbol "[=]" means in C++?
I am learning some C++ code which uses boost library. And there are some code like this:
getService().post( [=] {...} )
getService() is a function which returns an io_service of boost library. I want to know what this symbol "[=]" means in C++?
That means that the lambda expression captures values by assignment. Another option is to capture by reference using [&]. There are many variations on this, instead of listing them all here, I'll point you at this quality answer: What is a lambda expression in C++11?