0
std::thread([=]{

//my statements and my other stuff, basically here i am updating the database accordingly some conditions.

  }).detach();

So, what is the use, benefit or how to use this : std::thread([=]

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982

1 Answers1

0

In this code you are using lambda as std::thread function. [=] is a capture clause and means capture all external variable by value

auto lambdaExample = [](){ std::cout << "HELLO WORLD\n"; };
RANOK
  • 74
  • 7