mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2024-03-22 13:30:58 +08:00
Minor improvement.
This commit is contained in:
parent
fdd91e959a
commit
f11db25628
|
@ -3153,10 +3153,10 @@ Pointers and references to locals shouldn't outlive their scope. Lambdas that ca
|
|||
|
||||
{
|
||||
int local = 42;
|
||||
thread_pool.queue_work([&]{ process(local); }); // Want a reference to local.
|
||||
// Note, that after program exists this scope,
|
||||
// local does no longer exist,
|
||||
// therefore process() call will have undefined behavior!
|
||||
thread_pool.queue_work([&]{ process(local); }); // Want a reference to local.
|
||||
// Note, that after program exists this scope,
|
||||
// local does no longer exist, therefore
|
||||
// process() call will have undefined behavior!
|
||||
}
|
||||
|
||||
##### Example, good
|
||||
|
|
Loading…
Reference in New Issue
Block a user