C++ Logo

std-discussion

Advanced search

Re: Local variables

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Mon, 21 Feb 2022 11:10:49 -0500
On Mon, Feb 21, 2022 at 5:14 AM Vladimir Grigoriev via Std-Discussion
<std-discussion_at_[hidden]> wrote:
>
> At least In the C++ 20 Standard (6 Basics) there is written
>
> 7 A local entity is a variable with automatic storage duration (6.7.5.4), a structured binding (9.6) whose corresponding variable is such an entity, or the *this object

"Local entity" in C++20 is not the same thing as "local variable" in
C++17. They serve kind of similar purposes, but they're not the same
thing.

The term "local entity" in C++20 exists almost exclusively for use by
lambda capture logic, so as to allow lambdas to capture names that
specify structured bindings. How local entities get captured doesn't
change how static block variables get captured.

Received on 2022-02-21 16:11:01