On Sat 10/3/2026 5:15 PM, Chris M. Thomasson wrote:
Wondering about how the local struct can be extended out of the
function. auto magic?
Well, short answer: yes.
It is a rather popular observation that the introduction of `decltype`
made it much easier to break the protection formerly provided to type declarations by 'protected/private' access specifiers. Introduction of
`auto` placeholder for function return types extended this possibility
to local types, which before that were protected by the last remaining obstacle - impossibility to name the type.
This is widely used to return lambda closure objects from functions.
Note that a local lambda expression introduces an unnamed _local_ type
into the same scope. So, when you return such closure object from a
function (using `auto` placeholder for return type, of course), you are
doing essentially the same thing as what your example demonstrates.
--
Best regards,
Andrey
--- PyGate Linux v1.5.19
* Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)