On Wednesday, 9 March 2016 at 22:54:13 UTC, bigsandwich wrote:
Yes, I do. std::function<> uses type erasure to store a "function". If its small enough, its stored internally, otherwise it goes on the heap.
Yes, I believe that is said to be the common implementation, but people also claim it comes with significant overhead. I haven't seen any numbers, have you seen any benchmarks on the difference between a templated "C++ functor" on a parameter and std::function<>?
It uses RAII to manage the lifetime of the lambda. D is using the GC for managing the lifetime. D doesn't have a way of doing this without the GC.
I completely agree that D needs a lot of work to get the GC out of the way. I personally don't think std::function<> is doing the right thing.
