what is the point of functor ?

Flaze07 christianseiji.cs at gmail.com
Sun Jun 24 10:42:15 UTC 2018


On Friday, 22 June 2018 at 20:20:56 UTC, Steven Schveighoffer 
wrote:
> On 6/22/18 2:25 PM, Ali Çehreli wrote:
>> On 06/22/2018 08:17 AM, Steven Schveighoffer wrote:
>> 
>>  > reason to use functors
>> 
>> I wonder whether they are more efficient because a functor 
>> would carry just the state that it needs. Also, there is no GC 
>> memory allocation unless the programmer wants to.
>> 
>> I wonder how much state is allocated for a delegate?
>
> If it's not a closure, then none. It just uses the stack frame.
>
> Most of the time you would just use an alias instead of a 
> functor or a delegate.
>
> -Steve

I see, thank you


More information about the Digitalmars-d-learn mailing list