On 04/20/23 3:06 AM, Frederick Virchanza Gotham wrote:
>
> I realised today that you can create a lambda object outside of the function in which the lambda is defined:
>
> auto Func(int a)
> {
> auto mylambda = [](void)->int { return 27u; };
>
> return *decltype(&mylambda)(nullptr);
> }
>
A lot of things became trivially "non-isolated" in C++ the moment the
language started to support `auto` return types and `decltype`
(primarily the former). Local types, `private` types... Yes, this is how
it is intended to work. Get used to it.
--
Best regards,
Andrey