March 10, 2016
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.

March 10, 2016
On 3/8/16 10:04 PM, Jack Stouffer wrote:
> On Wednesday, 9 March 2016 at 01:18:26 UTC, maik klein wrote:
>> Direct link: https://maikklein.github.io/post/CppAndD/
>> Reddit link:
>> https://www.reddit.com/r/programming/comments/49lna6/a_comparison_between_c_and_d/
>>
>>
>> If you spot any mistakes, please let me know.
>
>> D moves objects with a bitwise copy, this means you should not have
>> internal pointers.
>
> Unless you define this(this) right?

No. It's perfectly legal to move a struct without calling the postblit AFAIK.

-Steve
1 2 3
Next ›   Last »