C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Stop gap required for NRVO until Anton's paper is assimilated

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Thu, 18 Jul 2024 10:16:22 +0100
On Thu, Jul 18, 2024 at 10:13 AM Frederick Virchanza Gotham wrote:
>
> Widget foo(int const i)
> {
> return construct_modify<Widget>(
> i,
> [](auto &a) -> bool { return a.some_observer; },
> [](auto &a) -> Widget { return Widget(0); }
> );
> }


Correction, that should be:

   Widget foo(int const i)
   {
     return construct_modify<Widget>(
         i,
         [](auto &a) -> bool { return a.some_observer(); },
         [](void ) -> Widget { return Widget(0); }
     );
   }

Received on 2024-07-18 09:16:34