...
Because entities captured are objects with automatic storage duration (or this
), a general guideline is that functions returning a lambda object (including returning via a reference parameter), or storing a lambda object in a member variable or global, should not capture an entity by reference because the lambda object will likely could outlive the captured reference object.
...