Can we fix this?

Sebastiaan Koppe mail at skoppe.eu
Thu Sep 30 14:07:18 UTC 2021


On Thursday, 30 September 2021 at 13:55:53 UTC, deadalnix wrote:
> On Thursday, 30 September 2021 at 11:36:01 UTC, bauss wrote:
>> On Thursday, 30 September 2021 at 11:32:28 UTC, Sebastiaan 
>> Koppe wrote:
>>> I rather have closures that require you to state what you 
>>> capture.
>>
>> I really like that in C++ because you don't clutter memory 
>> with unnecessary references. Your closure will only reference 
>> what you capture.
>
> I have good news for you: the compiler knows what you capture 
> and what you don't, so the only case where in which you'll have 
> unnecessary reference, is if you capture explicitly and mess it 
> up.

The upside with explicit capture is that you can specify you want 
a move/copy instead of a reference, side-stepping the OT's decade 
long problem.


More information about the Digitalmars-d mailing list