Motive behind !empty() with front() instead of Optional front()

Paul Backus snarwin at gmail.com
Tue Apr 6 21:09:13 UTC 2021


On Tuesday, 6 April 2021 at 20:47:31 UTC, Per Nordlöw wrote:
> On Tuesday, 6 April 2021 at 02:14:17 UTC, Paul Backus wrote:
>>     auto ref T identity(T)(auto ref T arg)
>>     {
>>         import core.lifetime: forward;
>>         return forward!arg;
>>     }
>
> When is the call to forward needed in this case?

For non-copyable types. It's actually needed in both cases--we 
would need DIP 1040 (or something similar) to get rid of it.


More information about the Digitalmars-d mailing list