what is the point of functor ?
Steven Schveighoffer
schveiguy at yahoo.com
Fri Jun 22 20:20:56 UTC 2018
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
More information about the Digitalmars-d-learn
mailing list