I used ([]{}) like the above, but I can't find where this grammar came from, or if there is such a thing in the function even if I press F3.
Is it a kind of function pointer to use as above?
Like this:
1.
thread t([&] { result = 1 + 2; });
2.
shared_ptr<thread> thread(new thread([&]() {
while (true)
{
int n;
{
lock_guard<recursive_mutex> num_lock(num_mutex);
n = num;
num++;
}
if (n >= MaxCount)
break;
if (IsPrimeNumber(n))
{
lock_guard<recursive_mutex> primes_lock(primes_mutex);
primes.push_back(n);
}
}
}));
As far as I know, function pointers have a form of void(*bp2)().
Since it is in the form ([]{}), I wonder what kind of grammar it is..